Skip to content

Commit

Permalink
Merge branch 'feat/markdown2tex'
Browse files Browse the repository at this point in the history
  • Loading branch information
Witiko committed Jan 27, 2025
2 parents ab0a443 + bc032b7 commit 626df6a
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 46 deletions.
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ Fixes:
- Allow using the options `linkAttributes` and `notes` together. (#543, #544)
Distribution:
- Alias the command `markdown-cli` as `markdown2tex`.
(#545, #546, [tex-live@tug.org][tex-live-2025-01-051051])
[tex-live-2025-01-051051]: https://tug.org/pipermail/tex-live/2025-January/051051.html
Docker:
- Produce Docker image `witiko/markdown:latest-minimal` with a minimum
Expand Down
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ rm -rfv ${PREINSTALLED_DIR}/tex/generic/markdown/
rm -rfv ${PREINSTALLED_DIR}/tex/latex/markdown/
rm -rfv ${PREINSTALLED_DIR}/tex/context/third/markdown/
rm -fv ${BINARY_DIR}/markdown-cli
rm -fv ${BINARY_DIR}/markdown2tex

# Uninstall the distribution lt3luabridge package
rm -rfv ${PREINSTALLED_DIR}/tex/generic/lt3luabridge/
Expand All @@ -140,6 +141,7 @@ cp ${BUILD_DIR}/markdown-parser.lua ${INSTALL_DIR}/tex/
cp ${BUILD_DIR}/markdown-unicode-data.lua ${INSTALL_DIR}/tex/luatex/markdown/
mkdir -p ${INSTALL_DIR}/scripts/markdown/
cp ${BUILD_DIR}/markdown-cli.lua ${INSTALL_DIR}/scripts/markdown/
cp ${BUILD_DIR}/markdown2tex.lua ${INSTALL_DIR}/scripts/markdown/
mkdir -p ${INSTALL_DIR}/tex/generic/markdown/
cp ${BUILD_DIR}/markdown.tex ${INSTALL_DIR}/tex/generic/markdown/
cp ${BUILD_DIR}/markdownthemewitiko_markdown_defaults.tex ${INSTALL_DIR}/tex/generic/markdown/
Expand All @@ -150,8 +152,9 @@ mkdir -p ${INSTALL_DIR}/tex/
cp ${BUILD_DIR}/t-markdown.tex ${INSTALL_DIR}/tex/context/third/markdown/
cp ${BUILD_DIR}/t-markdownthemewitiko_markdown_defaults.tex ${INSTALL_DIR}/tex/context/third/markdown/

# Make the markdown-cli script executable
# Make the markdown-cli and markdown2tex scripts executable
ln -s ${INSTALL_DIR}/scripts/markdown/markdown-cli.lua ${BINARY_DIR}/markdown-cli
ln -s ${INSTALL_DIR}/scripts/markdown/markdown2tex.lua ${BINARY_DIR}/markdown2tex

# Install the current lt3luabridge package
git clone https://github.com/witiko/lt3luabridge.git
Expand Down Expand Up @@ -273,6 +276,7 @@ rm -rfv ${PREINSTALLED_DIR}/tex/generic/markdown/
rm -rfv ${PREINSTALLED_DIR}/tex/latex/markdown/
rm -rfv ${PREINSTALLED_DIR}/tex/context/third/markdown/
rm -fv ${BINARY_DIR}/markdown-cli
rm -fv ${BINARY_DIR}/markdown2tex

# Uninstall the distribution lt3luabridge package
rm -rfv ${PREINSTALLED_DIR}/tex/generic/lt3luabridge/
Expand All @@ -288,8 +292,9 @@ set -o errexit
set -o nounset
set -o xtrace

# Make the markdown-cli script executable
# Make the markdown-cli and markdown2tex scripts executable
ln -s ${INSTALL_DIR}/scripts/markdown/markdown-cli.lua ${BINARY_DIR}/markdown-cli
ln -s ${INSTALL_DIR}/scripts/markdown/markdown2tex.lua ${BINARY_DIR}/markdown2tex

# Generate the ConTeXt file database
if echo ${TEXLIVE_TAG} | grep -q latest-minimal
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ HTML_USER_MANUAL=markdown.html markdown.css
USER_MANUAL=$(MARKDOWN_USER_MANUAL) $(HTML_USER_MANUAL)
DOCUMENTATION=$(TECHNICAL_DOCUMENTATION) $(HTML_USER_MANUAL) $(ROOT_README) $(VERSION_FILE) \
$(CHANGES_FILE) $(DEPENDENCIES)
INSTALLABLES=markdown.lua markdown-parser.lua markdown-cli.lua markdown-unicode-data.lua \
INSTALLABLES=markdown.lua markdown-parser.lua markdown-cli.lua markdown2tex.lua \
markdown-unicode-data.lua \
markdown.tex markdown.sty t-markdown.tex \
markdownthemewitiko_markdown_defaults.tex \
markdownthemewitiko_markdown_defaults.sty \
Expand Down Expand Up @@ -131,8 +132,8 @@ $(GITHUB_PAGES): $(HTML_USER_MANUAL)
# This target extracts the source files out of the DTX archive.
$(EXTRACTABLES): $(INSTALLER) $(DTXARCHIVE)
luatex $<
sed -i '1i#!/usr/bin/env texlua' markdown-cli.lua
chmod +x markdown-cli.lua
sed -i '1i#!/usr/bin/env texlua' markdown-cli.lua markdown2tex.lua
chmod +x markdown-cli.lua markdown2tex.lua
texlua markdown-unicode-data-generator.lua >> markdown-unicode-data.lua
sed -i \
-e 's#(((VERSION)))#$(VERSION)#g' \
Expand Down Expand Up @@ -228,7 +229,7 @@ $(TDSARCHIVE): $(DTXARCHIVE) $(INSTALLER) $(INSTALLABLES) $(DOCUMENTATION) $(EXA
tex/context/third/markdown scripts/markdown
cp markdown.lua markdown-parser.lua markdown-unicode-data.lua \
tex/luatex/markdown/
cp markdown-cli.lua scripts/markdown/
cp markdown-cli.lua markdown2tex.lua scripts/markdown/
cp markdown.tex markdownthemewitiko_markdown_defaults.tex tex/generic/markdown/
cp markdown.sty markdownthemewitiko_markdown_defaults.sty tex/latex/markdown/
cp t-markdown.tex t-markdownthemewitiko_markdown_defaults.tex tex/context/third/markdown/
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ BibTeX file that is included in your TeX distribution like this:
Notes to Distributors
---------------------

The file `markdown-cli.lua` should be installed in the TDS directory
The file `markdown2tex.lua` should be installed in the TDS directory
`scripts/markdown`. Furthermore, it should be made executable and either
symlinked to system directories as `markdown-cli` on Unix or have a wrapper
`markdown-cli.exe` installed on Windows.
symlinked to system directories as `markdown2tex` on Unix or have a wrapper
`markdown2tex.exe` installed on Windows.
2 changes: 1 addition & 1 deletion examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ optex.pdf: optex.tex
# 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
markdown-cli $(LUACLI_OPTIONS) -- $< $@
markdown2tex $(LUACLI_OPTIONS) -- $< $@

# This pseudo-target removes any existing auxiliary files and directories.
clean:
Expand Down
74 changes: 38 additions & 36 deletions markdown.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ make base
Either of the two abovelisted approaches should produce the following files:

* `markdown.lua`, `markdown-parser.lua`, and `markdown-unicode-data.lua`: The Lua module
* `markdown-cli.lua`: The Lua command-line interface
* `markdown-cli.lua` and `markdown2tex.lua`: The Lua command-line interface
* `markdown.tex`: The plain \TeX{} macro package
* `markdown.sty`: The \LaTeX{} package
* `markdownthemewitiko_markdown_defaults.tex`,
Expand All @@ -1059,6 +1059,7 @@ placed:
* `⟨TEXMF⟩/tex/luatex/markdown/markdown-parser.lua`
* `⟨TEXMF⟩/tex/luatex/markdown/markdown-unicode-data.lua`
* `⟨TEXMF⟩/scripts/markdown/markdown-cli.lua`
* `⟨TEXMF⟩/scripts/markdown/markdown2tex.lua`
* `⟨TEXMF⟩/tex/generic/markdown/markdown.tex`
* `⟨TEXMF⟩/tex/generic/markdown/markdownthemewitiko_markdown_defaults.tex`
* `⟨TEXMF⟩/tex/latex/markdown/markdown.sty`
Expand All @@ -1083,6 +1084,7 @@ This is where the individual files should be placed:
* `./markdown-parser.lua`
* `./markdown-unicode-data.lua`
* `./markdown-cli.lua`
* `./markdown2tex.lua`
* `./markdown/markdown.tex`
* `./markdown.sty`
* `./t-markdown.tex`
Expand Down Expand Up @@ -1655,14 +1657,14 @@ Hello *world*!
``````
Next, invoke LuaTeX from the terminal:
``` sh
markdown-cli -- hello.md hello.tex
markdown2tex -- hello.md hello.tex
luatex document.tex
``````

A PDF document named `document.pdf` should be produced and contain the text “Hello
*world*!” Invoking pdfTeX should have the same effect:
``` sh
markdown-cli -- hello.md hello.tex
markdown2tex -- hello.md hello.tex
pdftex document.tex
``````

Expand Down Expand Up @@ -2131,8 +2133,8 @@ $\sqrt{-1}$ *equals* $i$.
``````
Next, invoke LuaTeX from the terminal:
``` sh
markdown-cli -- example.md nomath.tex
markdown-cli tex_math_dollars=true -- example.md math.tex
markdown2tex -- example.md nomath.tex
markdown2tex tex_math_dollars=true -- example.md math.tex
luatex document.tex
``````

Expand All @@ -2147,8 +2149,8 @@ following text:

Invoking pdfTeX should have the same effect:
``` sh
markdown-cli -- example.md nomath.tex
markdown-cli tex_math_dollars=true -- example.md math.tex
markdown2tex -- example.md nomath.tex
markdown2tex tex_math_dollars=true -- example.md math.tex
pdftex document.tex
``````

Expand Down Expand Up @@ -2603,7 +2605,7 @@ Hello *world*!
Next, invoke LuaTeX from the terminal with the \Opt{eagerCache} option
disabled:
``` sh
markdown-cli eagerCache=false -- hello.md hello.tex
markdown2tex eagerCache=false -- hello.md hello.tex
```````

A \TeX{} document named `hello.tex` should be produced and contain the
Expand All @@ -2618,7 +2620,7 @@ Invoke LuaTeX from the terminal again, this time with the \Opt{eagerCache}
option enabled:

``` tex
markdown-cli eagerCache=true -- hello.md hello.tex
markdown2tex eagerCache=true -- hello.md hello.tex
```

A \TeX{} document named `hello.tex` should be produced and contain the
Expand Down Expand Up @@ -2971,7 +2973,7 @@ Hello *world*!
``````
Next, invoke LuaTeX from the terminal:
``` sh
markdown-cli cacheDir=cache -- hello.md hello.tex
markdown2tex cacheDir=cache -- hello.md hello.tex
luatex document.tex
```````

Expand Down Expand Up @@ -3345,7 +3347,7 @@ Hello *world*!
``````
Next, invoke LuaTeX from the terminal:
``` sh
markdown-cli finalizeCache=true frozenCacheFileName=cache.tex -- hello.md hello.tex
markdown2tex finalizeCache=true frozenCacheFileName=cache.tex -- hello.md hello.tex
luatex document.tex
```````

Expand Down Expand Up @@ -3650,8 +3652,8 @@ A paragraph.
``````
Next, invoke LuaTeX from the terminal:
``` sh
markdown-cli -- content.md optionfalse.tex
markdown-cli blankBeforeBlockquote=true -- content.md optiontrue.tex
markdown2tex -- content.md optionfalse.tex
markdown2tex blankBeforeBlockquote=true -- content.md optiontrue.tex
luatex document.tex
```````

Expand Down Expand Up @@ -3879,8 +3881,8 @@ A code fence?
```````
Next, invoke LuaTeX from the terminal:
``` sh
markdown-cli fencedCode=true -- content.md optionfalse.tex
markdown-cli fencedCode=true blankBeforeCodeFence=true -- content.md optiontrue.tex
markdown2tex fencedCode=true -- content.md optionfalse.tex
markdown2tex fencedCode=true blankBeforeCodeFence=true -- content.md optiontrue.tex
luatex document.tex
```````

Expand Down Expand Up @@ -4207,8 +4209,8 @@ A heading?
``````
Next, invoke LuaTeX from the terminal:
``` sh
markdown-cli -- content.md optionfalse.tex
markdown-cli blankBeforeHeading=true -- content.md optiontrue.tex
markdown2tex -- content.md optionfalse.tex
markdown2tex blankBeforeHeading=true -- content.md optiontrue.tex
luatex document.tex
```````

Expand Down Expand Up @@ -4437,8 +4439,8 @@ A paragraph.
```````
Next, invoke LuaTeX from the terminal:
``` sh
markdown-cli -- content.md optionfalse.tex
markdown-cli blankBeforeList=true -- content.md optiontrue.tex
markdown2tex -- content.md optionfalse.tex
markdown2tex blankBeforeList=true -- content.md optiontrue.tex
luatex document.tex
```````

Expand Down Expand Up @@ -4752,8 +4754,8 @@ following content:
``````
Next, invoke LuaTeX from the terminal:
``` sh
markdown-cli breakableBlockquotes=false -- content.md optionfalse.tex
markdown-cli -- content.md optiontrue.tex
markdown2tex breakableBlockquotes=false -- content.md optionfalse.tex
markdown2tex -- content.md optiontrue.tex
luatex document.tex
```````

Expand Down Expand Up @@ -5183,8 +5185,8 @@ following content:
``````
Next, invoke LuaTeX from the terminal:
``` sh
markdown-cli codeSpans=false -- content.md optionfalse.tex
markdown-cli -- content.md optiontrue.tex
markdown2tex codeSpans=false -- content.md optionfalse.tex
markdown2tex -- content.md optiontrue.tex
luatex document.tex
```````

Expand Down Expand Up @@ -7230,8 +7232,8 @@ _Is there <? HTML instruction ?> support?_
````````
Next, invoke LuaTeX from the terminal:
``` sh
markdown-cli html=false -- content.md optionfalse.tex
markdown-cli -- content.md optiontrue.tex
markdown2tex html=false -- content.md optionfalse.tex
markdown2tex -- content.md optiontrue.tex
luatex document.tex
```````

Expand Down Expand Up @@ -7538,8 +7540,8 @@ $\sqrt{-1}$ *equals* $i$.
``````
Next, invoke LuaTeX from the terminal:
``` sh
markdown-cli -- content.md optionfalse.tex
markdown-cli hybrid=true -- content.md optiontrue.tex
markdown2tex -- content.md optionfalse.tex
markdown2tex hybrid=true -- content.md optiontrue.tex
luatex document.tex
```````

Expand Down Expand Up @@ -9257,8 +9259,8 @@ Are these just three regular dots, a victorian ellipsis, or ... ?
``````
Next, invoke LuaTeX from the terminal:
``` sh
markdown-cli -- content.md optionfalse.tex
markdown-cli smartEllipses=true -- content.md optiontrue.tex
markdown2tex -- content.md optionfalse.tex
markdown2tex smartEllipses=true -- content.md optiontrue.tex
luatex document.tex
```````

Expand Down Expand Up @@ -10501,8 +10503,8 @@ $$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^
``````
Next, invoke LuaTeX from the terminal:
``` sh
markdown-cli -- content.md optionfalse.tex
markdown-cli texMathDollars=true -- content.md optiontrue.tex
markdown2tex -- content.md optionfalse.tex
markdown2tex texMathDollars=true -- content.md optiontrue.tex
luatex document.tex
```````

Expand Down Expand Up @@ -10706,8 +10708,8 @@ following content:
``````
Next, invoke LuaTeX from the terminal:
``` sh
markdown-cli -- content.md optionfalse.tex
markdown-cli texMathDoubleBackslash=true -- content.md optiontrue.tex
markdown2tex -- content.md optionfalse.tex
markdown2tex texMathDoubleBackslash=true -- content.md optiontrue.tex
luatex document.tex
```````

Expand Down Expand Up @@ -10911,8 +10913,8 @@ following content:
``````
Next, invoke LuaTeX from the terminal:
``` sh
markdown-cli -- content.md optionfalse.tex
markdown-cli texMathSingleBackslash=true -- content.md optiontrue.tex
markdown2tex -- content.md optionfalse.tex
markdown2tex texMathSingleBackslash=true -- content.md optiontrue.tex
luatex document.tex
```````

Expand Down Expand Up @@ -11367,7 +11369,7 @@ Report bugs to: witiko@mail.muni.cz
Markdown package home page: <https://github.com/witiko/markdown>]]

local VERSION_STRING = [[
markdown-cli.lua (Markdown) ]] .. metadata.version .. [[
markdown-cli (Markdown) ]] .. metadata.version .. [[

Copyright (C) ]] .. table.concat(metadata.copyright,
"\nCopyright (C) ") .. [[
Expand Down
1 change: 1 addition & 0 deletions markdown.ins
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
\file{markdown.lua}{\from{markdown.dtx}{lua-loader}}
\file{markdown-parser.lua}{\from{markdown.dtx}{lua}}
\file{markdown-cli.lua}{\from{markdown.dtx}{lua-cli}}
\file{markdown2tex.lua}{\from{markdown.dtx}{lua-cli}}
\file{markdown-unicode-data-generator.lua}{\from{markdown.dtx}{lua-unicode-data-generator}}
\file{markdown-unicode-data.lua}{\from{markdown.dtx}{lua-unicode-data}}
\usepreamble\texpreamble
Expand Down

0 comments on commit 626df6a

Please sign in to comment.