graph TD
A[Quarkdown 源文件 .qd] --> B[Lexer 词法分析]
B --> C[Parser 语法分析]
C --> D[AST 抽象语法树]
D --> E{"是否含可执行函数?"}
E -->|"是"| F[函数运行时<br/>变量/循环/条件]
E -->|"否"| G[直通渲染管道]
F --> G
G --> H{"目标格式"}
H -->|"HTML"| I[网页渲染器]
H -->|"PDF/论文"| J[文档渲染器]
H -->|"幻灯片"| K[幻灯片渲染器]
I --> L[输出产物]
J --> L
K --> L
Quarkdown is a modern Markdown-based typesetting system designed for versatility. It allows a single project to compile seamlessly into a print-ready book, academic paper, knowledge base, or interactive presentation.
All through an incredibly powerful Turing-complete extension of Markdown, ensuring your ideas flow automatically into paper.
Not enough? You can still define your own functions and variables, all within Markdown.
You can even create awesome libraries for everyone to use.
.function {greet}
to from:
**Hello, .to** from .from!
.greet {world} from:{iamgio}
Result: Hello, world from iamgio!
This out-of-the-box scripting support opens doors to complex and dynamic content that would be otherwise impossible
to achieve with vanilla Markdown.
Combined with live preview, :zap: fast compilation speed and great editor support, Quarkdown simply gets the work done,
whether it’s an academic paper, book, knowledge base or interactive presentation.
In a nutshell, Quarkdown is…
Familiar: built on the well-known Markdown syntax, for a flat learning curve
Elegant: produces output that matches the quality of industry-leading tools
Agent-friendly: comes with a built-in skill for idiomatic fluency of your coding agents (read the eval)
Customizable: full control over document layout, aesthetics, and properties
Community-driven: import packages and templates with a single line of code, or publish your own
Secure by default: a restrictive permission system limits access to system resources
Versatile: a single source compiles to multiple targets
Reactive: low-latency live previews for rapid iteration. The official wiki (100+ subdocuments) compiles in ~2 seconds
Reusable: repeated content can be turned into one-line function calls
Easily deployable: set a CD workflow up in under 3 minutes (example)
Looking for something?
Check out the wiki
to get started and learn more about the language and its features!
Root privileges let the script install Quarkdown into /opt/quarkdown and its wrapper script into /usr/local/bin/quarkdown.
The browser required for PDF export is installed automatically.
For more installation options, check out get-quarkdown.
See setup-quarkdown to easily integrate Quarkdown into your GitHub Actions workflows.
Manual installation
Instructions for manual installation
Download quarkdown.zip from the latest stable release and unzip it,
or build it with gradlew installDist.
Optionally, adding <install_dir>/bin to your PATH allows you easier access Quarkdown.
Requirements:
(Only for PDF export) A Chromium-family browser, such as chrome-headless-shell. See PDF export for details.
Quickstart
New user? You’ll find everything you need in the Quickstart guide to bring your first document to life!
Creating a project
quarkdown create [directory] will launch the prompt-based project wizard, making it quicker than ever
to set up a new Quarkdown project, with all metadata and initial content already present.
Compiling
Running quarkdown c file.qd will compile the given file and save the output to file.
If the project is composed by multiple source files, the target file must be the root one, i.e. the one that includes the other files.
If you would like to familiarize yourself with Quarkdown instead, quarkdown repl lets you play with an interactive REPL mode.
Options
The most commonly used options are:
-p or --preview: enables automatic content reloading after compiling.
-w or --watch: recompiles the source every time a file from the source directory is changed.
Tip 提示
Combine -p -w to achieve live preview!
--pdf: produces a PDF file. Learn more in the wiki’s PDF export page.
For the full list of options, check out the CLI options wiki page.
Mock document
Mock, written in Quarkdown, is a comprehensive collection of visual elements offered by the language,
making it ideal for exploring and understanding its key features — all while playing and experimenting hands-on with a concrete outcome in the form of pages or slides.
The document’s source files are available in the mock directory, and can be compiled via quarkdown c mock/main.qd -p.
The PDF artifacts generated for all possible theme combinations are available and can be viewed in the generated repo.
Contributing
Contributions are welcome! Please check CONTRIBUTING.md to know how contribute via issues or pull requests.
The logo resembles the original Markdown icon, with focus on Quarkdown’s completeness,
richness of features and customization options, emphasized by the revolving arrow all around the sphere.
What could be mistaken for a planet is actually a quark or, more specifically, a down quark,
an elementary particle that is a major constituent of matter: they give life to every complex structure we know of,
while also being one of the lightest objects in existence.
This is, indeed, the concept Quarkdown is built upon.
License
By default, Quarkdown and its modules are licensed under GNU GPLv3, except for modules that include their own LICENSE file:
the CLI (quarkdown-cli) and Language Server (quarkdown-lsp) modules and binaries are licensed under GNU AGPLv3.
评论