Skip to content

Commit

Permalink
Add a TeX4ht example document
Browse files Browse the repository at this point in the history
Progresses #90.
  • Loading branch information
Witiko committed Feb 27, 2022
1 parent 44affc3 commit b00280b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ ARCHIVES=$(TDSARCHIVE) $(CTANARCHIVE) $(DISTARCHIVE)
EXAMPLES_RESOURCES=examples/example.md examples/scientists.csv
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
examples/latex-pdftex.pdf examples/latex-luatex.pdf examples/latex-xetex.pdf \
examples/latex-tex4ht.html examples/latex-tex4ht.css
TESTS=tests/test.sh tests/support/*.tex tests/templates/*/*.tex.m4 \
tests/templates/*/COMMANDS.m4 tests/testfiles/*/*.test
MAKES=Makefile $(addsuffix /Makefile, $(SUBDIRECTORIES)) latexmkrc
Expand Down
11 changes: 10 additions & 1 deletion examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LUACLI_OPTIONS=cacheDir=_markdown_example hashEnumerators=true \
smartEllipses=true fencedCode=true contentBlocks=true pipeTables=true \
tableCaptions=true taskLists=true
OUTPUT=context-mkii.pdf context-mkiv.pdf latex-pdftex.pdf \
latex-luatex.pdf latex-xetex.pdf
latex-luatex.pdf latex-xetex.pdf latex-tex4ht.html latex-tex4ht.css

# This is the default pseudo-target.
all: $(OUTPUT)
Expand Down Expand Up @@ -41,6 +41,14 @@ latex-luatex.pdf: latex.tex example.tex
lualatex latex-luatex
lualatex latex-luatex

# This target typesets the LaTeX example using TeX4ht.
latex-tex4ht.html latex-tex4ht.css: latex.tex example.tex
-make4ht --shell-escape latex fn-in
cp latex.html latex-tex4ht.html
sed -ri 's/latex\.(html|css)/latex-tex4ht.\1/g' latex-tex4ht.html
cp latex.css latex-tex4ht.css
make4ht -m clean latex

# This target converts the markdown example to a plain TeX representation
# using the Lua command-line interface for the Markdown package.
example.tex: example.md
Expand All @@ -50,6 +58,7 @@ example.tex: example.md
clean:
rm -f $(AUXFILES)
rm -rf $(AUXDIRS)
make4ht -m clean latex

# This pseudo-target removes any makeable files.
implode: clean
Expand Down
19 changes: 19 additions & 0 deletions examples/latex.tex
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,23 @@
\begin{markdown}
Here are some non-ASCII characters: *ěščřžýáíé*.
\end{markdown}

\begin{markdown*}{html, hybrid}
Here is some <b>HTML code</b> mixed *with Markdown*. In pdfTeX, the HTML code
will be silently ignored, whereas in \TeX 4ht, the HTML code will be passed
through to the output:

<table border="1">
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
<tr>
<td>16</td>
<td>14</td>
<td>10</td>
</tr>
</table>
\end{markdown*}
\end{document}

0 comments on commit b00280b

Please sign in to comment.