Skip to content

Commit

Permalink
Add example document for ConTeXt MkIV
Browse files Browse the repository at this point in the history
Progresses #17
  • Loading branch information
Witiko committed Jan 29, 2022
1 parent 9d840be commit 8bbb6ab
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 11 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ examples/context-mkii.markdown.lua
examples/context-mkii.markdown.out
examples/context-mkii-mpgraph.mp
examples/context-mkii.pdf
examples/context-mkii.tex
examples/context-mkii.tmp
examples/context-mkii.tui
examples/context-mkii.tuo
examples/context-mkiv.log
examples/context-mkiv.markdown.in
examples/context-mkiv.pdf
examples/context-mkiv.tex
examples/context-mkiv.tuc
examples/example.tex
examples/latex-luatex.aux
Expand Down Expand Up @@ -75,3 +73,4 @@ markdown.zip
_minted-markdown/
t-markdown.tex
markdownthemewitiko_*.sty
libraries/markdown-tinyyaml.lua
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CTANARCHIVE=markdown.ctan.zip
DISTARCHIVE=markdown.zip
ARCHIVES=$(TDSARCHIVE) $(CTANARCHIVE) $(DISTARCHIVE)
EXAMPLES_RESOURCES=examples/example.md examples/scientists.csv
EXAMPLES_SOURCES=examples/context.tex examples/latex.tex
EXAMPLES_SOURCES=examples/context-mkii.tex examples/context-mkiv.tex examples/latex.tex
EXAMPLES=examples/context-mkii.pdf examples/context-mkiv.pdf \
examples/latex-pdftex.pdf examples/latex-luatex.pdf examples/latex-xetex.pdf
TESTS=tests/test.sh tests/support/*.tex tests/templates/*/*.tex.m4 \
Expand Down Expand Up @@ -149,7 +149,8 @@ $(TDSARCHIVE): $(DTXARCHIVE) $(INSTALLER) $(INSTALLABLES) $(DOCUMENTATION) $(EXA
mkdir -p doc/generic/markdown doc/latex/markdown/examples \
doc/context/third/markdown/examples
cp $(DOCUMENTATION) doc/generic/markdown/
cp examples/context.tex $(EXAMPLES_RESOURCES) doc/context/third/markdown/examples/
cp examples/context-mkii.tex examples/context-mkiv.tex $(EXAMPLES_RESOURCES) \
doc/context/third/markdown/examples/
cp examples/latex.tex $(EXAMPLES_RESOURCES) doc/latex/markdown/examples/
@# Installing the sources.
mkdir -p source/generic/markdown
Expand Down
8 changes: 3 additions & 5 deletions examples/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: all clean

AUXFILES=*.tmp *.tui *.tuo *.mp *.tuc *.markdown.in *.markdown.out \
*.markdown.lua *.log *.aux context-mkii.tex context-mkiv.tex \
*.markdown.lua *.log *.aux \
latex-pdftex.tex latex-xetex.tex latex-luatex.tex example.tex
AUXDIRS=_markdown_*/
LUACLI_OPTIONS=cacheDir=_markdown_example hashEnumerators=true \
Expand All @@ -16,13 +16,11 @@ all: $(OUTPUT)
$(MAKE) clean

# This target typesets the ConTeXt example using the Mark II format.
context-mkii.pdf: context.tex example.tex
cp context.tex context-mkii.tex
context-mkii.pdf: context-mkii.tex example.tex
texexec --passon="--shell-escape --8bit" context-mkii.tex

# This target typesets the ConTeXt example using the Mark IV format.
context-mkiv.pdf: context.tex example.tex
cp context.tex context-mkiv.tex
context-mkiv.pdf: context-mkiv.tex example.tex
context context-mkiv.tex

# This target typesets the LaTeX example using the pdfTeX engine.
Expand Down
20 changes: 18 additions & 2 deletions examples/context.tex → examples/context-mkii.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
\usetypescript[modern][ec]
\setupbodyfont[10pt,rm]
\setupexternalfigures[location={local,global,default}]

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

% Set options of the Markdown module.
\def\markdownOptionHashEnumerators{true}
\def\markdownOptionDefinitionLists{true}
\def\markdownOptionSmartEllipses{true}
Expand All @@ -13,9 +17,17 @@
\def\markdownOptionPipeTables{true}
\def\markdownOptionTableCaptions{true}
\def\markdownOptionTaskLists{true}
\definetyping [latex]
\setuptyping [latex] [option=TEX]

% 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.
\markdownInput{./example.md}
Expand All @@ -25,13 +37,17 @@
% of the document `example.md`.
\doiffileelse{./example.tex}{\input example}{}

% 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
65 changes: 65 additions & 0 deletions examples/context-mkiv.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,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.
\def\markdownOptionHashEnumerators{true}
\def\markdownOptionDefinitionLists{true}
\def\markdownOptionSmartEllipses{true}
\def\markdownOptionFootnotes{true}
\def\markdownOptionInlineFootnotes{true}
\def\markdownOptionFencedCode{true}
\def\markdownOptionContentBlocks{true}
\def\markdownOptionPipeTables{true}
\def\markdownOptionTableCaptions{true}
\def\markdownOptionTaskLists{true}

% 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

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

% 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

0 comments on commit 8bbb6ab

Please sign in to comment.