3

typeup - a markup language that gets out of your way

 3 years ago
source link: https://skuz.xyz/typeup/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
a markup language that gets out of your way

typeup - a markup language that gets out of your way

tl;dr:
  • Whitespace indifference
  • Less characters to see and type
  • Very simple to parse
  • Zero-dependency parser - no syntax highlighting, no YAML, no regexes
  • Batteries included
# h1
###### h6
Headers (1-6) are just like Markdown
=# title
Titles set the metadata attribute title and the document title in HTML, groff and LaTeX, rather than just being a header
*bold*
_italic_
`code`
*_`nested`_*
Styling is similar to markdown but bolding only uses 1 wrapping character
[link https://skuz.xyz]
Text enclosed in [] becomes a link. The last word in the bracket is the hyperlink, the rest is the text
![alt text https://placekitten.com/200/200]
Images are as in markdown - links prefixed with a !
| quote

"""
multiline
quote
"""
Single-line quotes are not joined. Multiline quotes are not prefixed and behave like paragraphs
===
package main

import (
    "fmt"
)

func main(){
    fmt.Println("hello world")
}
===
Multiline code is as in Markdown, with less thorny delimiters
[
    foo
    bar
    baz
    {
        one
        two
        three
    }
]
Instead of prefixing each item with + or manually numbering items, lists are enclosed. Unordered lists are enclosed with [] and ordered lists are enclosed with {}. Nesting is done by simply inserting lists, instead of indentation. The indentation in this example is only for aesthetic purposes. It is meaningless as typeup strips all whitespace from the start of the line
#,{
name,statically typed,GC,compiled
Go,yes,yes,yes
Zig,yes,no,yes
Python,no,yes,no
}

#:{
Language: Family
Irish: Celtic
Kannada: Dravidian
Swahili: Bantu
}
Tables are enclosed, whatever-you-want separated values. There is no dividing row between the header and body - the first row becomes the header row. Any delimiter can be chosen so CSV data and colon separated lists can be wrapped without changes.
@{key = value}

@{
key = value
}
typeup has a built-in metadata format instead of using YAML/TOML frontmatter. It is simply keys associated with values. Some, such as title are used by renderers. Metadata can be retrieved at the command-line

Get started

The reference implementation of typeup is written in Janet and lives here. It is work-in-progress but can parse all syntax elements

  1. Install Janet (see also the official guide)
  2. Install the package:
    sudo jpm install 'https://git.sr.ht/~skuzzymiglet/typeup-janet'

Usage

typeup <output format> (reads standard input, writes to standard output)
typeup < my-document.tup > output-file.html

For a playground in the terminal, try i

Output formats

  • html - HTML output (not strict) - default
  • md - Markdown (GitHub Flavored)
  • ast - Pretty-printed internal AST
  • meta.<key> - Print the metadata key key

Planned output formats

  • troff-ms - Troff/Groff Manuscript
  • latex - LaTeX
  • pandoc - Pandoc JSON AST
  • typeup - Pretty-printed typeup (use as a formatter)

Planned features

  • Checklists
  • Footnotes
  • Subscript and superscript
  • Renderer options

Other links



About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK