forked from jgm/lunamark
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathcontext-mkiv.tex
118 lines (99 loc) · 2.74 KB
/
context-mkiv.tex
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
\enableregime[utf]
\usetypescript[modern][ec]
\setupbodyfont[10pt,rm]
\setupexternalfigures[location={local,global,default}]
% Load the Markdown module.
\startluacode
local kpse = require("kpse")
kpse.set_program_name("luatex")
\stopluacode
\usemodule[t][markdown]
% Set options of the Markdown module.
\setupmarkdown
[
contentBlocks = yes,
debugExtensions = yes,
definitionLists = yes,
fancy_lists = yes,
fencedCode = yes,
hashEnumerators = yes,
inlineNotes = yes,
lineBlocks = yes,
notes = yes,
pipeTables = yes,
rawAttribute = yes,
smartEllipses = yes,
strikethrough = yes,
subscripts = yes,
superscripts = yes,
tableCaptions = yes,
taskLists = yes,
texMathDollars = yes,
texMathDoubleBackslash = yes,
texMathSingleBackslash = yes,
]
% Set renderers of the Markdown module.
\definehighlight
[markdownRendererEmphasis]
[style=\em]
\definehighlight
[markdownRendererStrongEmphasis]
[style=bold]
\definehighlight
[markdownRendererCodeSpan]
[style=mono]
\definetyping
[latex]
\setuptyping
[latex]
[option=TEX]
\starttext
% Set and typeset the document metadata using a YAML metadata block.
\setupyaml
[
jekyllDataRenderers = {
title = {\gdef\doctitle{#1}},
author = {\gdef\author{#1}},
date = {\gdef\date{#1}},
},
renderers = {
jekyllDataEnd = {%
\startalignment[center]
\blank[force,2*big]
{\tfd \doctitle}
\blank[3*medium]
{\tfa \author}
\blank[2*medium]
{\tfa \date}
\blank[3*medium]
\stopalignment
},
},
]
\startyaml
title: An Example *Markdown* Document
author: Vít Starý Novotný
date: `\currentdate`{=tex}
\stopyaml
% Typeset the document `example.md` by letting the Markdown package handle
% the conversion internally. Optionally, we can specify additional options
% between the square brackets similarly to the command `\setupmarkdown`.
% Unlike `\setupmarkdown`, the options will only apply for this document.
\inputmarkdown[smart_ellipses = yes]{./example.md}
% Typeset the document `example.tex` that we prepared separately using the
% Lua command-line interface and that contains a plain TeX representation
% of the document `example.md`.
\catcode`\%=12\relax
\catcode`\#=12\relax
\doiffileelse{./example.tex}{\input example}{}
\catcode`\%=14\relax
\catcode`\#=6\relax
% Besides inputting external files, Markdown text can we written directly
% into a LaTeX document. Markdown text and LaTeX code can be freely combined.
\startmarkdown
This is a paragraph of *Markdown text* with inline `\LaTeX`{=tex} code.
``` {=tex}
This is a paragraph of \LaTeX{} code with inline \markinline{*Markdown text*}.
```
\stopmarkdown
\stoptext