size: 1004 B

1Capitalize text:
2
3```
4*Hello* world `code`
5!
6return {
7 str = function(e)
8 e.text = e.text:upper()
9 end
10}
11.
12<p><strong>HELLO</strong> WORLD <code>code</code></p>
13```
14
15Capitalize text inside emphasis only:
16
17```
18_Hello *world*_ outside
19!
20local capitalize = 0
21return {
22 emph = {
23 enter = function(e)
24 capitalize = capitalize + 1
25 end,
26 exit = function(e)
27 capitalize = capitalize - 1
28 end,
29 },
30 str = function(e)
31 if capitalize > 0 then
32 e.text = e.text:upper()
33 end
34 end
35}
36.
37<p><em>HELLO <strong>WORLD</strong></em> outside</p>
38```
39
40Capitalize text except in footnotes:
41
42``` a
43Hello[^1].
44
45[^1]: This is a note.
46!
47return {
48 str = function(e)
49 e.text = e.text:upper()
50 end,
51 footnote = {
52 enter = function(e)
53 return true -- prevent traversing into children
54 end
55 }
56}
57.
58doc
59 para
60 str text="HELLO"
61 footnote_reference text="1"
62 str text="."
63footnotes
64 ["1"] =
65 footnote
66 para
67 str text="This is a note."
68```