# `gmi.scm` ## Text ```gmi some text ``` ```scm "some text" ``` Just a string, not tagged in any way. Empty lines are kept. ## Headers ``` ^(#+)\s+(.*)$ ``` ```scm `(header ,(string-length $1) ,$2) ``` If `*strict-gemtext-headers*` is enabled, header lines of level > 3 are not considered headers. ```gmi ##### title ``` ```scm "##### title" ; (w/ *strict-gemtext-headers* enabled) '(header 5 "title") ; (w/ *strict-gemtext-headers* disabled) ``` ## Links ```gmi => some-uri.gmi Optional alt text ``` ```scm '(link "some-uri.gmi" "Optional alt text") ``` If there's no alt text, the empty string is used: ```gmi => some-uri.gmi ``` ```scm '(link "some-uri.gmi" "") ``` ## Lists ```gmi * item 1 * item 2 ``` ```scm '(list "item 1" "item 2") ``` ## Code blocks (pretend there's no space in between the three backticks) ```gmi `` `some optional alt text some pre-formatted text `` ` ``` ```scm '(code "some optional alt text" "some" "pre-formatted" "text") ``` If there's no alt text, the empty string is used: ```gmi `` `some optional alt text some pre-formatted text `` ` ``` ```scm '(code "" "some" "pre-formatted" "text") ``` ## Example ```gmi # Factorial There are two steps to compute the factorial of a number: * Compute the list of integers from 1 up to the number * Multiply all the integers of the list => https://en.wikipedia.org/wiki/Factorial => gemini://gemi.dev/cgi-bin/wp.cgi/view?Factorial Factorial (Gemipedia) ## Haskell code Here's the code in Haskell: `` `hs fact n = prod [1..n] `` ` ``` ```scm '((header 1 "Factorial") "" "There are two steps to compute the factorial of a number:" "" (list "Compute the list of integers from 1 up to the number" "Multiply all the integers of the list") "" (link "https://en.wikipedia.org/wiki/Factorial" "") (link "gemini://gemi.dev/cgi-bin/wp.cgi/view?Factorial" "Factorial (Gemipedia)") "" (header 2 "Haskell code") "" "Here's the code in Haskell:" "" (code "hs" "fact n = prod [1..n]")) ``` ## Output Patterns ```scm (header level title) (link uri alt-text) (code alt-text . lines) (list . items) ```