summaryrefslogtreecommitdiff
path: root/desk/lib/p.hoon
blob: 88064100bc3919866e156ca96c2e1fe50a2cd57e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|%
++  dinfix  |*  [pf=rule sf=rule]
=/  neither  (star ;~(less ;~(pose pf sf) next))
;~(pfix pf ;~(sfix neither sf))
++  infix  
|*  =rule
(ifix [rule rule] (star ;~(less rule next)))
+$  block
$%  [%p p=paragraph]
    [%blockquote p=paragraph]
    [%list p=(list paragraph) ordered=?]
    [%tasklist p=(list task)]
    [%heading p=paragraph h=?(%h1 %h2 %h3 %h4 %h5 %h6)]
    [%table rows=(list (list paragraph))]
    [%codeblock code=@t lang=@t]
==
+$  paragraph  (list inline)
+$  task  [text=paragraph done=?]
+$  inline
$%  [%b p=paragraph]
    [%i p=paragraph]
    [%del p=paragraph]  :: strikethrough
    [%a href=@t text=@t]
    [%img src=@t alt=@t]
    [%codespan p=@t]
    [%footnote id=@t text=paragraph]
    [%br ~]
    [%text p=@t]
==
++  brk   (just '\0a')
:: ++  words  (cook (crip zing (star word)))                ::  indefinite tarp
++  tics  ;~(plug tic tic tic brk)
++  white  (plus ace)  :: whitespace
++  bq  ;~(pfix ;~(plug gar ace) (plus inli))
++  blok
  ;~  pose
      (stag %blockquote bq)
      (stag %p (plus inli))
  ==
++  inli
  ;~  pose
    ::  *bold*
      (stag %b (infix tar))
      (cold [%br ~] brk)
      (stag %text (star next))
    ::  _italic_
    ::   (stag %i (ifix cab))
    :: ::  `code`
    ::   (stag %codespan (ifix tic))
    :: :: [li](nk)
    ::   %+  stag  %link
    ::   ;~  plug  
    ::     (dinfix [sel ser])
    ::     (dinfix [pal par])
    ::   ==
    :: ::  ![alt](image)
    ::   %+  stag  %mage
    ::   ;~  pfix  zap
    ::   ;~  plug  
    ::     (dinfix [sel ser])
    ::     (dinfix [pal par])
    ::   ==
    ::   ==
  ==
--