-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsyntax.html
1791 lines (1758 loc) · 52.8 KB
/
syntax.html
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang xml:lang>
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>Djot syntax reference</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list[class]{list-style: none;}
ul.task-list li input[type="checkbox"] {
font-size: inherit;
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
</style>
<style type="text/css">html {
line-height: 1.4;
font-family: Georgia, serif;
font-size: 18px;
color: #1a1a1a;
background-color: #fdfdfd;
}
body {
display: flex;
margin: 0 auto;
padding-left: 50px;
padding-right: 50px;
padding-top: 50px;
padding-bottom: 50px;
hyphens: auto;
overflow-wrap: break-word;
text-rendering: optimizeLegibility;
font-kerning: normal;
}
@media (max-width: 600px) {
body {
font-size: 0.9em;
padding: 1em;
}
h1 {
font-size: 1.8em;
}
}
@media print {
body {
background-color: transparent;
color: black;
font-size: 12pt;
}
p, h2, h3 {
orphans: 3;
widows: 3;
}
h2, h3, h4 {
page-break-after: avoid;
}
}
p {
margin: 1em 0;
}
a {
color: #1a1a1a;
}
a:visited {
color: #1a1a1a;
}
img {
max-width: 100%;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 1.4em;
}
h1 {
margin-top: 0.4em;
}
h5, h6 {
font-size: 1em;
font-style: italic;
}
h6 {
font-weight: normal;
}
h1 {
font-size: 28px;
}
h2 {
font-size: 24px;
}
h3 {
font-size: 20px;
}
ol, ul {
padding-left: 1.7em;
margin-top: 1em;
}
li > ol, li > ul {
margin-top: 0;
}
blockquote {
margin: 1em 0 1em 1.7em;
padding-left: 1em;
border-left: 2px solid #e6e6e6;
color: #606060;
}
code {
font-family: Menlo, Monaco, 'Lucida Console', Consolas, monospace;
font-size: 85%;
margin: 0;
}
pre {
margin: 1em 0;
overflow: auto;
}
pre code {
padding: 0;
overflow: visible;
overflow-wrap: normal;
}
.sourceCode {
background-color: transparent;
overflow: visible;
}
hr {
background-color: #1a1a1a;
border: none;
height: 1px;
margin: 1em 0;
}
table {
margin: 1em 0;
border-collapse: collapse;
width: 100%;
overflow-x: auto;
display: block;
font-variant-numeric: lining-nums tabular-nums;
}
table caption {
margin-bottom: 0.75em;
}
tbody {
margin-top: 0.5em;
border-top: 1px solid #1a1a1a;
border-bottom: 1px solid #1a1a1a;
}
tr {
vertical-align: top;
}
th {
border-top: 1px solid #1a1a1a;
padding: 0.25em 0.5em 0.25em 0.5em;
}
td {
padding: 0.125em 0.5em 0.25em 0.5em;
}
header {
margin-bottom: 4em;
text-align: center;
}
section.level1 {
max-width: 44em;
position: relative;
order: 1;
max-width: 48em;
min-width: 300px;
padding-bottom: 60em;
}
#TOC {
order: 2;
position: sticky;
top: 2rem;
max-width: 20em;
min-width: 12em;
align-self: baseline;
background: transparent;
}
#TOC > ul {
margin-top: 1em;
margin-left: 2em;
height: 96vh;
overflow-y: scroll;
font-size: 14px;
}
#TOC li {
list-style: none;
}
#TOC ul {
padding-left: 1em;
}
#TOC > ul {
padding-left: 0;
}
#TOC a:not(:hover) {
text-decoration: none;
}
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
.example {
display: flex;
border: 1px solid grey;
border-radius: 5px;
}
@media (max-width: 860px) {
.example {
flex-direction: column;
}
}
.example pre, .example div {
padding: 0pt 12pt 0pt 12pt;
}
.example .html {
padding: 0;
flex: 1;
flex-wrap: wrap;
}
.example .djot {
padding: 0;
flex: 1;
flex-wrap: wrap;
background-color: #ddd;
}
.example code {
font-size: 78%;
}
</style>
</head>
<body>
<nav id="TOC" role="doc-toc">
<ul>
<li><a href="#djot-syntax-reference" id="toc-djot-syntax-reference">Djot syntax reference</a>
<ul>
<li><a href="#inline-syntax" id="toc-inline-syntax">Inline syntax</a>
<ul>
<li><a href="#precedence" id="toc-precedence">Precedence</a></li>
<li><a href="#ordinary-text" id="toc-ordinary-text">Ordinary text</a></li>
<li><a href="#link" id="toc-link">Link</a></li>
<li><a href="#image" id="toc-image">Image</a></li>
<li><a href="#autolink" id="toc-autolink">Autolink</a></li>
<li><a href="#verbatim" id="toc-verbatim">Verbatim</a></li>
<li><a href="#emphasisstrong" id="toc-emphasisstrong">Emphasis/strong</a></li>
<li><a href="#highlighted" id="toc-highlighted">Highlighted</a></li>
<li><a href="#supersubscript" id="toc-supersubscript">Super/subscript</a></li>
<li><a href="#insertdelete" id="toc-insertdelete">Insert/delete</a></li>
<li><a href="#smart-punctuation" id="toc-smart-punctuation">Smart punctuation</a></li>
<li><a href="#math" id="toc-math">Math</a></li>
<li><a href="#footnote-reference" id="toc-footnote-reference">Footnote reference</a></li>
<li><a href="#line-break" id="toc-line-break">Line break</a></li>
<li><a href="#comment" id="toc-comment">Comment</a></li>
<li><a href="#symbols" id="toc-symbols">Symbols</a></li>
<li><a href="#raw-inline" id="toc-raw-inline">Raw inline</a></li>
<li><a href="#span" id="toc-span">Span</a></li>
<li><a href="#inline-attributes" id="toc-inline-attributes">Inline attributes</a></li>
</ul></li>
<li><a href="#block-syntax" id="toc-block-syntax">Block syntax</a>
<ul>
<li><a href="#paragraph" id="toc-paragraph">Paragraph</a></li>
<li><a href="#heading" id="toc-heading">Heading</a></li>
<li><a href="#block-quote" id="toc-block-quote">Block quote</a></li>
<li><a href="#list-item" id="toc-list-item">List item</a></li>
<li><a href="#list" id="toc-list">List</a></li>
<li><a href="#code-block" id="toc-code-block">Code block</a></li>
<li><a href="#thematic-break" id="toc-thematic-break">Thematic break</a></li>
<li><a href="#raw-block" id="toc-raw-block">Raw block</a></li>
<li><a href="#div" id="toc-div">Div</a></li>
<li><a href="#pipe-table" id="toc-pipe-table">Pipe table</a></li>
<li><a href="#reference-link-definition" id="toc-reference-link-definition">Reference link definition</a></li>
<li><a href="#footnote" id="toc-footnote">Footnote</a></li>
<li><a href="#block-attributes" id="toc-block-attributes">Block attributes</a></li>
<li><a href="#links-to-headings" id="toc-links-to-headings">Links to headings</a></li>
</ul></li>
<li><a href="#nesting-limits" id="toc-nesting-limits">Nesting limits</a></li>
</ul></li>
</ul>
</nav>
<section id="djot-syntax-reference" class="level1">
<h1>Djot syntax reference</h1>
<section id="inline-syntax" class="level2">
<h2>Inline syntax</h2>
<section id="precedence" class="level3">
<h3>Precedence</h3>
<p>Most inline syntax is defined by opening and closing delimiters that
surround inline content, defining it as emphasized, or as link text, for
example. The basic principle governing “precedence” for inline
containers is that the first opener that gets closed takes precedence.
Containers can’t overlap, so once an opener gets closed, any potential
openers between the opener and the closer get marked as regular text and
can no longer open inline syntax. For example, in</p>
<div class="example">
<div class="djot">
<pre><code>_This is *regular_ not strong* emphasis</code></pre>
</div>
<div class="html">
<pre><code><p><em>This is *regular</em> not strong* emphasis</p>
</code></pre>
</div>
</div>
<p>the regular emphasis opened by the first <code>_</code> gets closed by the second
<code>_</code>, at which point the first <code>*</code> is no longer eligible to open strong
emphasis. But in</p>
<div class="example">
<div class="djot">
<pre><code>*This is _strong* not regular_ emphasis</code></pre>
</div>
<div class="html">
<pre><code><p><strong>This is _strong</strong> not regular_ emphasis</p>
</code></pre>
</div>
</div>
<p>it goes just the opposite way.</p>
<p>Similarly,</p>
<div class="example">
<div class="djot">
<pre><code>[Link *](url)*</code></pre>
</div>
<div class="html">
<pre><code><p><a href="url">Link *</a>*</p>
</code></pre>
</div>
</div>
<p>contains a link, while</p>
<div class="example">
<div class="djot">
<pre><code>*Emphasis [*](url)</code></pre>
</div>
<div class="html">
<pre><code><p><strong>Emphasis [</strong>](url)</p>
</code></pre>
</div>
</div>
<p>does not (because the strong emphasis closes over the <code>[</code> delimiter).</p>
<p>Although overlapping containers are ruled out, <em>nested</em> containers are
fine:</p>
<div class="example">
<div class="djot">
<pre><code>_This is *strong within* regular emphasis_</code></pre>
</div>
<div class="html">
<pre><code><p><em>This is <strong>strong within</strong> regular emphasis</em></p>
</code></pre>
</div>
</div>
<p>In cases of ambiguity, <code>{</code> and <code>}</code> may be used to mark delimiters as
openers or closers. Thus <code>{_</code> behaves like <code>_</code> but can <em>only</em> open
emphasis, while <code>_}</code> behaves like <code>_</code> but can <em>only</em> close emphasis:</p>
<div class="example">
<div class="djot">
<pre><code>{_Emphasized_}
_}not emphasized{_</code></pre>
</div>
<div class="html">
<pre><code><p><em>Emphasized</em>
_}not emphasized{_</p>
</code></pre>
</div>
</div>
<p>Explicitly marked closers can only match explicitly marked
openers, and non-marked closers can only match non-marked
openers (so, for example, <code>{_hi_</code>) doesn’t produce emphasis).</p>
<p>When there are multiple openers that might be matched with a
given closer, the closest one is used. For example:</p>
<div class="example">
<div class="djot">
<pre><code>*not strong *strong*</code></pre>
</div>
<div class="html">
<pre><code><p>*not strong <strong>strong</strong></p>
</code></pre>
</div>
</div>
</section>
<section id="ordinary-text" class="level3">
<h3>Ordinary text</h3>
<p>Anything that isn’t given a special meaning is parsed as literal text.</p>
<p>All ASCII punctuation characters (even those that have no special
meaning in djot) may be backslash-escaped. Thus, <code>\*</code> includes a
literal <code>*</code> character. Backslashes before characters other than ASCII
punctuation characters are just treated as literal backslashes, with the
following exceptions:</p>
<ul>
<li>Backslash before a newline (or before spaces or tabs followed
by a newline) is parsed as a hard line break. Spaces and tab
characters before the backslash are ignored in this case.</li>
<li>Backslash before a space is parsed as a nonbreaking space.</li>
</ul>
</section>
<section id="link" class="level3">
<h3>Link</h3>
<p>There are two kinds of links, <em>inline</em> links and <em>reference</em> links.</p>
<p>Both kinds start with the link text (which may contain arbitrary inline
formatting) inside <code>[</code> … <code>]</code> delimiters.</p>
<p><em>Inline links</em> then contain the link destination (URL) in parentheses.
There should be no space between the <code>]</code> at the end of the link text and
the open <code>(</code> defining the link destination.</p>
<div class="example">
<div class="djot">
<pre><code>[My link text](http://example.com)</code></pre>
</div>
<div class="html">
<pre><code><p><a href="http://example.com">My link text</a></p>
</code></pre>
</div>
</div>
<p>The URL may be split over multiple lines; in that case, the line breaks
and any leading and trailing space is ignored, and the lines are
concatenated together.</p>
<div class="example">
<div class="djot">
<pre><code>[My link text](http://example.com?product_number=234234234234
234234234234)</code></pre>
</div>
<div class="html">
<pre><code><p><a href="http://example.com?product_number=234234234234234234234234">My link text</a></p>
</code></pre>
</div>
</div>
<p><em>Reference links</em> use a reference label in square brackets, instead of a
destination in parentheses. This must come immediately after the link
text:</p>
<div class="example">
<div class="djot">
<pre><code>[My link text][foo bar]
[foo bar]: http://example.com</code></pre>
</div>
<div class="html">
<pre><code><p><a href="http://example.com">My link text</a></p>
</code></pre>
</div>
</div>
<p>The reference label should be defined somewhere in the document: see
<a href="#reference-link-definition">Reference link definition</a>, below. However, the parsing of the
link is “local” and does not depend on whether the label is
defined:</p>
<div class="example">
<div class="djot">
<pre><code>[foo][bar]</code></pre>
</div>
<div class="html">
<pre><code><p><a>foo</a></p>
</code></pre>
</div>
</div>
<p>If the label is empty, then the link text will be taken to be the
reference label as well as the link text:</p>
<div class="example">
<div class="djot">
<pre><code>[My link text][]
[My link text]: /url</code></pre>
</div>
<div class="html">
<pre><code><p><a href="/url">My link text</a></p>
</code></pre>
</div>
</div>
</section>
<section id="image" class="level3">
<h3>Image</h3>
<p>Images work just like links, but have a <code>!</code> prefixed. As with links,
both inline and reference variants are possible.</p>
<div class="example">
<div class="djot">
<pre><code>
![picture of a cat][cat]
![cat][]
[cat]: feline.jpg</code></pre>
</div>
<div class="html">
<pre><code><p><img alt="picture of a cat" src="cat.jpg"></p>
<p><img alt="picture of a cat" src="feline.jpg"></p>
<p><img alt="cat" src="feline.jpg"></p>
</code></pre>
</div>
</div>
</section>
<section id="autolink" class="level3">
<h3>Autolink</h3>
<p>A URL or email address that is enclosed in <code><</code>…<code>></code> will be hyperlinked.
The content between pointy braces is treated literally
(backslash-escapes may not be used).</p>
<div class="example">
<div class="djot">
<pre><code><https://pandoc.org/lua-filters>
<[email protected]></code></pre>
</div>
<div class="html">
<pre><code><p><a href="https://pandoc.org/lua-filters">https://pandoc.org/lua-filters</a>
<a href="mailto:[email protected]">[email protected]</a></p>
</code></pre>
</div>
</div>
<p>The URL or email address may not contain a newline.</p>
</section>
<section id="verbatim" class="level3">
<h3>Verbatim</h3>
<p>Verbatim content begins with a string of consecutive backtick characters
(<code>`</code>) and ends with an equal-lengthed string of consecutive backtick
characters.</p>
<div class="example">
<div class="djot">
<pre><code>``Verbatim with a backtick` character``
`Verbatim with three backticks ``` character`</code></pre>
</div>
<div class="html">
<pre><code><p><code>Verbatim with a backtick` character</code>
<code>Verbatim with three backticks ``` character</code></p>
</code></pre>
</div>
</div>
<p>Material between the backticks is treated as verbatim text (backslash
escapes don’t work there).</p>
<p>If the content starts or ends with a backtick character, a single space
is removed between the opening or closing backticks and the content.</p>
<div class="example">
<div class="djot">
<pre><code>`` `foo` ``</code></pre>
</div>
<div class="html">
<pre><code><p><code>`foo`</code></p>
</code></pre>
</div>
</div>
<p>If the text to be parsed as inline ends before a closing backtick string
is encountered, the verbatim text extends to the end.</p>
<div class="example">
<div class="djot">
<pre><code>`foo bar</code></pre>
</div>
<div class="html">
<pre><code><p><code>foo bar</code></p>
</code></pre>
</div>
</div>
</section>
<section id="emphasisstrong" class="level3">
<h3>Emphasis/strong</h3>
<p>Emphasized inline content is delimited by <code>_</code> characters. Strong
emphasis is delimited by <code>*</code> characters.</p>
<div class="example">
<div class="djot">
<pre><code>_emphasized text_
*strong emphasis*</code></pre>
</div>
<div class="html">
<pre><code><p><em>emphasized text</em></p>
<p><strong>strong emphasis</strong></p>
</code></pre>
</div>
</div>
<p>A <code>_</code> or <code>*</code> can open emphasis only if it is not directly followed by
whitespace. It can close emphasis only if it is not directly preceded by
whitespace, and only if there are some characters besides the delimiter
character between the opener and the closer.</p>
<div class="example">
<div class="djot">
<pre><code>_ Not emphasized (spaces). _
___ (not an emphasized `_` character)</code></pre>
</div>
<div class="html">
<pre><code><p>_ Not emphasized (spaces). _</p>
<p>___ (not an emphasized <code>_</code> character)</p>
</code></pre>
</div>
</div>
<p>Emphasis can be nested:</p>
<div class="example">
<div class="djot">
<pre><code>__emphasis inside_ emphasis_</code></pre>
</div>
<div class="html">
<pre><code><p><em><em>emphasis inside</em> emphasis</em></p>
</code></pre>
</div>
</div>
<p>Curly braces may be used to force interpretation of a <code>_</code> or <code>*</code> either
as an opener or as a closer.</p>
<div class="example">
<div class="djot">
<pre><code>{_ this is emphasized, despite the spaces! _}</code></pre>
</div>
<div class="html">
<pre><code><p><em> this is emphasized, despite the spaces! </em></p>
</code></pre>
</div>
</div>
</section>
<section id="highlighted" class="level3">
<h3>Highlighted</h3>
<p>Inline content between <code>{=</code> and <code>=}</code> will be treated as highlighted text
(in HTML, <code><mark></code>). Note that the <code>{</code> and <code>}</code> are mandatory.</p>
<div class="example">
<div class="djot">
<pre><code>This is {=highlighted text=}.</code></pre>
</div>
<div class="html">
<pre><code><p>This is <mark>highlighted text</mark>.</p>
</code></pre>
</div>
</div>
</section>
<section id="supersubscript" class="level3">
<h3>Super/subscript</h3>
<p>Superscript is delimited by <code>^</code> characters, subscript by <code>~</code>.</p>
<div class="example">
<div class="djot">
<pre><code>H~2~O and djot^TM^</code></pre>
</div>
<div class="html">
<pre><code><p>H<sub>2</sub>O and djot<sup>TM</sup></p>
</code></pre>
</div>
</div>
<p>Curly braces may be used, but are not required:</p>
<div class="example">
<div class="djot">
<pre><code>H{~one two buckle my shoe~}O</code></pre>
</div>
<div class="html">
<pre><code><p>H<sub>one two buckle my shoe</sub>O</p>
</code></pre>
</div>
</div>
</section>
<section id="insertdelete" class="level3">
<h3>Insert/delete</h3>
<p>To mark inline text as inserted, use <code>{+</code> and <code>+}</code>. To mark it as
deleted, use <code>{-</code> and <code>-}</code>. The <code>{</code> and <code>}</code> are mandatory.</p>
<div class="example">
<div class="djot">
<pre><code>My boss is {-mean-}{+nice+}.</code></pre>
</div>
<div class="html">
<pre><code><p>My boss is <del>mean</del><ins>nice</ins>.</p>
</code></pre>
</div>
</div>
</section>
<section id="smart-punctuation" class="level3">
<h3>Smart punctuation</h3>
<p>Straight double quotes (<code>"</code>) and single quotes (<code>'</code>) are parsed as curly
quotes. Djot is pretty good about figuring out from context which
direction of quote is needed.</p>
<div class="example">
<div class="djot">
<pre><code>"Hello," said the spider.
"'Shelob' is my name."</code></pre>
</div>
<div class="html">
<pre><code><p>&ldquo;Hello,&rdquo; said the spider.
&ldquo;&lsquo;Shelob&rsquo; is my name.&rdquo;</p>
</code></pre>
</div>
</div>
<p>However, its heuristics can be overridden by
using curly braces to mark a quote as an opener <code>{"</code> or a closer <code>"}</code>:</p>
<div class="example">
<div class="djot">
<pre><code>'}Tis Socrates' season to be jolly!</code></pre>
</div>
<div class="html">
<pre><code><p>&rsquo;Tis Socrates&rsquo; season to be jolly!</p>
</code></pre>
</div>
</div>
<p>If you want a straight quote, use a backslash-escape:</p>
<div class="example">
<div class="djot">
<pre><code>5\'11\"</code></pre>
</div>
<div class="html">
<pre><code><p>5'11"</p>
</code></pre>
</div>
</div>
<p>A sequence of three periods is parsed as <em>ellipses</em>.</p>
<p>A sequence of three hyphens is parsed as an <em>em-dash</em>.</p>
<p>A sequence of two hyphens is parsed as an <em>en-dash</em>.</p>
<div class="example">
<div class="djot">
<pre><code>57--33 oxen---and no sheep...</code></pre>
</div>
<div class="html">
<pre><code><p>57&ndash;33 oxen&mdash;and no sheep&hellip;</p>
</code></pre>
</div>
</div>
<p>Longer sequences of hyphens are divided into em-dashes, en-dashes, and
hyphens; uniformly, if possible, and preferring em-dashes, when
uniformity can be achieved either way. (So, 4 hyphens become two
en-dashes, while 6 hyphens become two em-dashes).</p>
<div class="example">
<div class="djot">
<pre><code>a----b c------d</code></pre>
</div>
<div class="html">
<pre><code><p>a&ndash;&ndash;b c&mdash;&mdash;d</p>
</code></pre>
</div>
</div>
</section>
<section id="math" class="level3">
<h3>Math</h3>
<p>To include LaTeX math, put the math in a verbatim span and prefix it
with <code>$</code> (for inline math) or <code>$$</code> (for display math):</p>
<div class="example">
<div class="djot">
<pre><code>Einstein derived $`e=mc^2`.
Pythagoras proved
$$` x^n + y^n = z^n `</code></pre>
</div>
<div class="html">
<pre><code><p>Einstein derived <span class="math inline">\(e=mc^2\)</span>.
Pythagoras proved
<span class="math display">\[ x^n + y^n = z^n \]</span></p>
</code></pre>
</div>
</div>
</section>
<section id="footnote-reference" class="level3">
<h3>Footnote reference</h3>
<p>A footnote reference is <code>^</code> + the reference label in square brackets.</p>
<div class="example">
<div class="djot">
<pre><code>Here is the reference.[^foo]
[^foo]: And here is the note.</code></pre>
</div>
<div class="html">
<pre><code><p>Here is the reference.<a id="fnref1" href="#fn1" role="doc-noteref"><sup>1</sup></a></p>
<section role="doc-endnotes">
<hr>
<ol>
<li id="fn1">
<p>And here is the note.<a href="#fnref1" role="doc-backlink">↩︎︎</a></p>
</li>
</ol>
</section>
</code></pre>
</div>
</div>
<p>See <a href="#footnote">Footnote</a>, below, for the syntax of the footnote itself.</p>
</section>
<section id="line-break" class="level3">
<h3>Line break</h3>
<p>Line breaks in inline content are treated as “soft” breaks; they may be
rendered as spaces, or (in contexts where newlines are treated
semantically like spaces, such as HTML) as newlines.</p>
<p>To get a hard line break (of the sort represented by HTML’s <code><br></code>), use
backslash + newline:</p>
<div class="example">
<div class="djot">
<pre><code>This is a soft
break and this is a hard\
break.</code></pre>
</div>
<div class="html">
<pre><code><p>This is a soft
break and this is a hard<br>
break.</p>
</code></pre>
</div>
</div>
</section>
<section id="comment" class="level3">
<h3>Comment</h3>
<p>Material between two <code>%</code> characters in an attribute will be ignored and
treated as a comment. This allows comments to be added to attributes:</p>
<div class="example">
<div class="djot">
<pre><code>{#ident % later we'll add a class %}</code></pre>
</div>
<div class="html">
<pre><code></code></pre>
</div>
</div>
<p>But it also serves as a general way to add comments. Just use an
attribute specifier that contains only a comment:</p>
<div class="example">
<div class="djot">
<pre><code>Foo bar {% This is a comment, spanning
multiple lines %} baz.</code></pre>
</div>
<div class="html">
<pre><code><p>Foo bar baz.</p>
</code></pre>
</div>
</div>
</section>
<section id="symbols" class="level3">
<h3>Symbols</h3>
<p>Surrounding a word with <code>:</code> signs creates a “symbol,” which by
default is just rendered literally but may be treated specially
by a filter. (For example, a filter could convert symbols to
emojis. But this is not built into djot.)</p>
<div class="example">
<div class="djot">
<pre><code>My reaction is :+1: :smiley:.</code></pre>
</div>
<div class="html">
<pre><code><p>My reaction is :+1: :smiley:.</p>
</code></pre>
</div>
</div>
</section>
<section id="raw-inline" class="level3">
<h3>Raw inline</h3>
<p>Raw inline content in any format may be included using a verbatim span
followed by <code>{=FORMAT}</code>:</p>
<div class="example">
<div class="djot">
<pre><code>This is `<?php echo 'Hello world!' ?>`{=html}.</code></pre>
</div>
<div class="html">
<pre><code><p>This is <?php echo 'Hello world!' ?>.</p>
</code></pre>
</div>
</div>
<p>This content is intended to be passed through verbatim when rendering
the designated format, but ignored otherwise.</p>
</section>
<section id="span" class="level3">
<h3>Span</h3>
<p>Text in square brackets that is not a link or image and is followed
immediately by an attribute is treated as a generic span.</p>
<div class="example">
<div class="djot">
<pre><code>It can be helpful to [read the manual]{.big .red}.</code></pre>
</div>
<div class="html">
<pre><code><p>It can be helpful to <span class="big red">read the manual</span>.</p>
</code></pre>
</div>
</div>
</section>
<section id="inline-attributes" class="level3">
<h3>Inline attributes</h3>
<p>Attributes are put inside curly braces and must <em>immediately follow</em> the
inline element to which they are attached (with no intervening
whitespace).</p>
<p>Inside the curly braces, the following syntax is possible:</p>
<ul>
<li><code>.foo</code> specifies <code>foo</code> as a class. Multiple classes may be given in
this way; they will be combined.</li>
<li><code>#foo</code> specifies <code>foo</code> as an identifier. An element may have only one
identifier; if multiple identifiers are given, the last one is used.</li>
<li><code>key="value"</code> or <code>key=value</code> specifies a key-value attribute. Quotes
are not needed when the value consists entirely of ASCII alphanumeric
characters or <code>_</code> or <code>:</code> or <code>-</code>. Backslash escapes may be used inside
quoted values.</li>
<li><code>%</code> begins a comment, which ends with the next <code>%</code> or the end of the
attribute (<code>}</code>).</li>
</ul>
<p>Attribute specifiers may contain line breaks.</p>
<p>Example:</p>
<div class="example">
<div class="djot">
<pre><code>An attribute on _emphasized text_{#foo
.bar .baz key="my value"}</code></pre>
</div>
<div class="html">
<pre><code><p>An attribute on <em class="bar baz" id="foo" key="my value">emphasized text</em></p>
</code></pre>
</div>
</div>
<p>Attribute specifiers may be “stacked,” in which case they will be
combined. Thus,</p>
<div class="example">
<div class="djot">
<pre><code>avant{lang=fr}{.blue}</code></pre>
</div>
<div class="html">
<pre><code><p><span class="blue" lang="fr">avant</span></p>
</code></pre>
</div>
</div>
<p>is the same as</p>
<div class="example">
<div class="djot">
<pre><code>avant{lang=fr .blue}</code></pre>
</div>
<div class="html">
<pre><code><p><span class="blue" lang="fr">avant</span></p>
</code></pre>
</div>
</div>
</section>
</section>
<section id="block-syntax" class="level2">
<h2>Block syntax</h2>
<p>As in commonmark, block structure can be discerned prior to inline
parsing and takes priority over inline structure.</p>
<p>Indeed, blocks can be parsed line by line with no backtracking. The
contribution a line makes to block-level structure never depends on a
future line.</p>
<p>Indentation is only significant for list item or footnote nesting.</p>
<p>Block-level items should be separated from one another by blank lines.
There are some cases in which two block-level elements can be
adjacent—e.g., a thematic break or fenced code block can be directly
followed by a paragraph. Indeed, the possibility of line-by-line parsing
precludes requiring a blank line after a block-level element. But for
readability, we recommend <em>always</em> separating block-level elements by
blank lines. Paragraphs can never be interrupted by other block-level
elements, and must always end with a blank line (or the end of the
document or containing element).</p>
<section id="paragraph" class="level3">
<h3>Paragraph</h3>
<p>A paragraph is a sequence of nonblank lines that does not meet the
condition for being one of the other block-level elements. The textual
content is parsed as a sequence of inline elements. Newlines are treated
as soft breaks and interpreted like spaces in formatted output. A
paragraph ends with a blank line or the end of the document.</p>
</section>
<section id="heading" class="level3">
<h3>Heading</h3>
<p>A heading starts with a sequence of one or more <code>#</code> characters,
followed by whitespace. The number of <code>#</code> characters defines
the heading level. The following text is parsed as inline content.</p>
<div class="example">
<div class="djot">
<pre><code>## A level _two_ heading!</code></pre>
</div>
<div class="html">
<pre><code><section id="A-level-two-heading">
<h2>A level <em>two</em> heading!</h2>
</section>
</code></pre>
</div>
</div>
<p>The heading text may spill over onto following lines, which may
also be preceded by the same number of <code>#</code> characters (but
these can also be left off).</p>
<p>The heading ends when a blank line (or the end of the document
or enclosing container) is encountered.</p>
<div class="example">
<div class="djot">
<pre><code># A heading that
# takes up
# three lines
A paragraph, finally</code></pre>
</div>
<div class="html">
<pre><code><section id="A-heading-that-takes-up-three-lines">
<h1>A heading that
takes up
three lines</h1>
<p>A paragraph, finally</p>
</section>
</code></pre>
</div>
</div>
<div class="example">
<div class="djot">
<pre><code># A heading that
takes up
three lines
A paragraph, finally.</code></pre>
</div>
<div class="html">
<pre><code><section id="A-heading-that-takes-up-three-lines">
<h1>A heading that
takes up
three lines</h1>
<p>A paragraph, finally.</p>
</section>
</code></pre>
</div>
</div>
</section>
<section id="block-quote" class="level3">
<h3>Block quote</h3>
<p>A block quote is a sequence of lines, each of which begins with <code>></code>,
followed either by a space or by the end of the line. The contents of
the block quote (minus initial <code>></code>) are parsed as block-level content.</p>
<div class="example">
<div class="djot">
<pre><code>> This is a block quote.
>
> 1. with a
> 2. list in it.</code></pre>
</div>
<div class="html">