urbit/try/lib/markdown.hoon

76 lines
2.3 KiB
Plaintext
Raw Normal View History

2014-05-01 22:34:30 +04:00
::
2014-05-05 21:48:27 +04:00
:: Markdown in Hoon.
2014-05-01 22:34:30 +04:00
::
2014-05-05 21:48:27 +04:00
=<
|%
++ markdown :: block elements
$& [p=markdown q=markdown]
$% [%$ p=markline] :: plain text
[%cobl p=(list ,@t)] :: code block
[%head p=head-level q=markline] :: heading
[%html p=manx] :: inline html
[%list p=(unit list-order) q=(list markdown)] :: un/ordered list
[%quot p=markdown] :: block quote
==
++ markline :: inline elements
$& [p=markline q=markline]
$% [%$ p=@t] :: plain text
[%bold p=markline-bold] :: strong emphasis
[%coli p=@t] :: inline code
[%emph p=markline-emph] :: emphasis
[%link p=purl q=markline-link r=(unit ,@t)] :: anchor
==
--
2014-05-01 22:34:30 +04:00
|%
2014-05-05 22:17:52 +04:00
++ head-level
|= a=*
?@ a
?:(|((lth a 1) (gth a 6)) 1 a)
1
2014-05-05 21:48:27 +04:00
++ list-order ,[p=?(%a %aa %1) q=@] :: list type/start
++ markline-bold
$& [p=markline-bold q=markline-bold]
$% [%$ p=@t]
[%coli p=@t]
[%emph p=markline-bold-emph]
[%link p=purl q=markline-bold-link r=(unit ,@t)]
==
++ markline-emph
$& [p=markline-emph q=markline-emph]
$% [%$ p=@t]
[%bold p=markline-bold-emph]
[%coli p=@t]
[%link p=purl q=markline-emph-link r=(unit ,@t)]
==
++ markline-link
$& [p=markline-link q=markline-link]
$% [%$ p=@t]
[%bold p=markline-bold-link]
[%coli p=@t]
[%emph p=markline-emph-link]
==
++ markline-bold-emph
$& [p=markline-bold-emph q=markline-bold-emph]
$% [%$ p=@t]
[%coli p=@t]
[%link p=purl q=markline-bold-emph-link r=(unit ,@t)]
==
++ markline-bold-link
$& [p=markline-bold-link q=markline-bold-link]
$% [%$ p=@t]
[%coli p=@t]
[%emph p=markline-bold-emph-link]
==
++ markline-emph-link
$& [p=markline-emph-link q=markline-emph-link]
$% [%$ p=@t]
[%bold p=markline-bold-emph-link]
[%coli p=@t]
==
++ markline-bold-emph-link
$& [p=markline-bold-emph-link q=markline-bold-emph-link]
$% [%$ p=@t]
[%coli p=@t]
==
2014-05-01 22:34:30 +04:00
--