summaryrefslogtreecommitdiff
path: root/macros/generic/markdown/examples/context-mkii.tex
blob: 77809fa16b3e28aa29e112a96d4caaec2474762e (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
\enableregime[utf]
\usetypescript[modern][ec]
\setupbodyfont[10pt,rm]
\setupexternalfigures[location={local,global,default}]

% Load the Markdown module.
\usemodule[t][markdown]

% Set options of the Markdown module.
\setupmarkdown
  [
    hashEnumerators = yes,
    debugExtensions = yes,
    definitionLists = yes,
    smartEllipses = yes,
    footnotes = yes,
    inlineFootnotes = yes,
    fencedCode = yes,
    contentBlocks = yes,
    pipeTables = yes,
    tableCaptions = yes,
    taskLists = yes,
    strikeThrough = yes,
    superscripts = yes,
    subscripts = yes,
    fancyLists = yes,
  ]

% Set renderers of the Markdown module.
\definetyping
  [latex]

\setuptyping
  [latex]
  [option=TEX]

\starttext

% Typeset the document `example.md` by letting the Markdown package handle
% the conversion internally.
\inputmarkdown{./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

% Typeset inline markdown text.
\startmarkdown

Here are some non-ASCII characters: *ěščřžýáíé*
and ConTeXt special characters: *|*.

Here is a hard line break that we inserted directly from the TeX source
by typing two spaces at the end of a line.  
This is stretching TeX's abilities and is only supported in ConTeXt MkIV
and later.

\stopmarkdown

\stoptext