Skip to content

iamgio/quarkdown

Repository files navigation

Quarkdown

Quarkdown is a work-in-progress markup language to create documents with the minimalism and straightforwardness of Markdown, while allowing full control over the structure and style of the document that LaTeX provides via a Turing complete, dynamically typed scripting engine.

The base Markdown parsing is CommonMark-compliant, along with several GFM extensions.

Overview

Basics

CommonMark/GFM Markdown is (almost) 100% supported. Along with it, Quarkdown's flavor introduces the following:

  • Math span
    $ \LaTeX expression $

  • Math block

    $$$
    \LaTeX expression
    $$$
    
  • Image size specification:

    • !(150x100)[label](/url.png) (manual width and height)
    • !(150x_)[label](/url.png) (manual width, automatic height, keeps the aspect ratio)
    • !(_x100)[label](/url.png) (automatic width, manual height, keeps the aspect ratio)
  • Functions:

    • .func
    • .func {arg1} {arg2}
    • .func {arg1} {arg2}
          This is some nested body content.
      

Scripting

Block function calls, opposite to inline function calls, also support a body argument, which is some nested and indented Quarkdown content.

The following snippets are valid Quarkdown sources that calculate and display the first 8 numbers of the Fibonacci sequence:

  • Iterative:
    .var {t1} {0}
    .var {t2} {1}
    
    .table
        .foreach {..8}
            | $ F_{<<1>>} $ |
            |:-------------:|
            |      .t1      |
            .var {tmp} {.sum {.t1} {.t2}}
            .var {t1} {.t2}
            .var {t2} {.tmp}
  • Recursive:
    .function {fib}
        num:
        .if { .islower {<<num>>} than:{2} }
            <<num>>
        .ifnot { .islower {<<num>>} than:{2} }
            .sum {
                .fib { .subtract {<<num>>} {1} }
            } {
                .fib { .subtract {<<num>>} {2} }
            }
    
    .table
        .foreach {..7}
            | $ F_<<1>> $  |
            |:------------:|
            | .fib {<<1>>} |

Output:

$F_0$ $F_1$ $F_2$ $F_3$ $F_4$ $F_5$ $F_6$ $F_7$
0 1 1 2 3 5 8 13

Goals

This is an example of what Quarkdown aims to look like:

.docname {Quarkdown}
.docauthor {iamgio}
.aspectratio {4:3}

.tableofcontents    <-- Generates a table of contents page
                        that contains "Hello Quarkdown"
                        and "Extended Markdown"

# Hello Quarkdown

## An overview

.box {Box title}
    This is some text within a box.
    1. And this
    2. is a
    3. Markdown list

.center
    This content is **centered**!
    ![An image](img.png)

# Extended Markdown

Quarkdown's custom Markdown flavor introduces new blocks as well!

$ This is a LaTeX expression $

Status

The project is under development. Currently supported:

  • Base Markdown blocks

    • Paragraphs
    • Headings
    • Code
    • Quotes
    • Lists (+ GFM tasks)
    • Horizontal lines
    • Link references
    • GFM tables
    • GFM footnotes
  • Base Markdown inline

    • Text
    • Links
    • Reference links
    • Autolinks (+ GFM extension)
    • Images
    • Reference images
    • Comments
    • Emphasis
    • Code spans
    • GFM strikethrough
  • Quarkdown features

    • Functions
    • Styles
    • Math (LaTeX) blocks and inlines
    • Highlight
    • Subscript/superscript
  • Rendering

    • HTML
    • LaTeX
  • Misc

    • GUI (with dynamic hot reload)

About

(WIP) Markdown with superpowers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published