Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix/support-eager-cac…
Browse files Browse the repository at this point in the history
…he-in-plain-luatex
  • Loading branch information
Witiko committed Dec 16, 2024
2 parents 74f9049 + 278c340 commit 90191a5
Show file tree
Hide file tree
Showing 13 changed files with 1,080 additions and 1,249 deletions.
61 changes: 52 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,18 @@ jobs:
with:
repository: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
- name: Install TeX Live
uses: teatimeguest/setup-texlive-action@v3
with:
packages: |
latexmk
scheme-minimal
xetex
- name: Install additional packages
run: |
set -ex
sudo apt -qy update
sudo apt -qy install --no-install-recommends git latexmk lua-check make texlive-xetex
sudo apt -qy install --no-install-recommends git lua-check make
- name: Extract scripts
run: make base
- name: Check the line length
Expand All @@ -74,15 +81,48 @@ jobs:
with:
repository: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
- name: Install TeX Live
uses: teatimeguest/setup-texlive-action@v3
with:
packages: |
latexmk
scheme-minimal
xetex
- name: Install additional packages
run: |
set -ex
sudo apt -qy update
sudo apt -qy install --no-install-recommends git latexmk lua-check make texlive-xetex
sudo apt -qy install --no-install-recommends git lua-check make
- name: Extract Lua scripts
run: make base
- name: Run luacheck
run: luacheck *.lua
explcheck:
name: Style check (expl3)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
- name: Install TeX Live
uses: teatimeguest/setup-texlive-action@v3
with:
packages: |
expltools
latexmk
scheme-minimal
xetex
- name: Install additional packages
run: |
set -ex
sudo apt -qy update
sudo apt -qy install --no-install-recommends git make
- name: Extract TeX files
run: make base
- name: Run explcheck
run: explcheck --warnings-are-errors -- *.tex *.sty
markdownlint:
name: Style check (Markdown)
runs-on: ubuntu-latest
Expand All @@ -92,11 +132,18 @@ jobs:
with:
repository: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
- name: Install TeX Live
uses: teatimeguest/setup-texlive-action@v3
with:
packages: |
latexmk
scheme-minimal
xetex
- name: Install additional packages
run: |
set -ex
sudo apt -qy update
sudo apt -qy install --no-install-recommends git latexmk lua-check make texlive-xetex
sudo apt -qy install --no-install-recommends git make
- name: Extract user manual
run: make markdown-transcluded.md
- name: Run MarkdownLint
Expand Down Expand Up @@ -150,13 +197,13 @@ jobs:
- linelength
- shellcheck
- luacheck
- explcheck
- markdownlint
- pytype
strategy:
fail-fast: true
matrix:
texlive:
- TL2022-historic
- TL2023-historic
- latest
# Only test latest TeX Live in pull requests.
Expand All @@ -167,7 +214,6 @@ jobs:
include:
- { texlive: latest }
outputs:
TL2022-historic: ${{ steps.temporary-tags.outputs.TL2022-historic }}
TL2023-historic: ${{ steps.temporary-tags.outputs.TL2023-historic }}
latest: ${{ steps.temporary-tags.outputs.latest }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -206,7 +252,6 @@ jobs:
fail-fast: true
matrix:
texlive:
- TL2022-historic
- TL2023-historic
- latest
# Only test latest TeX Live in pull requests.
Expand Down Expand Up @@ -235,7 +280,7 @@ jobs:
- name: Test Lua command-line interface
run: |
set -ex
printf '%s\n' 'Hello *Markdown*! $a_x + b_x = c_x$' | bash -c 'time markdown-cli texMathDollars=true' 1>stdout 2>stderr
printf '%s\n' 'Hello *Markdown*! $a_x + b_x = c_x$' | bash -c 'time markdown-cli eagerCache=false texMathDollars=true' 1>stdout 2>stderr
test "$(cat stdout)" = '\markdownRendererDocumentBegin
Hello \markdownRendererEmphasis{Markdown}! \markdownRendererInlineMath{a_x + b_x = c_x}\markdownRendererDocumentEnd' # Check that the output is correct.
grep 'real\s*0m[01]' stderr # Check that the command finishes in less than a second.
Expand All @@ -251,7 +296,6 @@ jobs:
fail-fast: true
matrix:
texlive:
- TL2022-historic
- TL2023-historic
- latest
# Only test latest TeX Live in pull requests.
Expand Down Expand Up @@ -286,7 +330,6 @@ jobs:
fail-fast: true
matrix:
texlive:
- TL2022-historic
- TL2023-historic
- latest
# Only test latest TeX Live in pull requests.
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "libraries/lua-tinyyaml"]
path = libraries/lua-tinyyaml
url = https://github.com/api7/lua-tinyyaml
[submodule "contributions/pandoc-to-markdown"]
path = contributions/pandoc-to-markdown
url = https://github.com/drehak/pandoc-to-markdown.git
Expand Down
1 change: 1 addition & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ MD041: false
MD046: false
MD049: false
MD050: false
MD051: false
MD053: false
85 changes: 82 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,47 @@
# Changes

## 3.9.0
## 3.9.1

Continuous Integration:

- Use explcheck to check expl3 code in the continuous integration.
(#535, #536, b4e3bfcd)

Distribution:

- Make `markdown-cli` executable and symlink it to system directories.
(#534, #537, [[email protected]][tex-live-2024-12-050952])

[tex-live-2024-12-050952]: https://tug.org/pipermail/tex-live/2024-December/050952.html

## 3.9.0 (2024-11-21)

Development:

- Convert built-in LaTeX themes `witiko/dot` and `witiko/graphicx/http` into
plain TeX themes. (#514, #522, #529)

This allows these themes to be used in formats such as plain TeX and ConTeXt
as well.

Refactoring:

- Remove dependencies on `ifthen`, `gobble`, and `catchfile`. (#514, #522, #529)

- Store small built-in LaTeX themes `witiko/dot`, `witiko/graphicx/http`, and
`witiko/tilde` in expl3 props in files `markdown.tex` and `markdown.sty`.
(#514, #522, #529)

This simplifies the distribution and installation of these themes, which were
previously located in individual `.tex` and `.sty` files.

The built-in plain TeX, LaTeX, and ConTeXt themes `witiko/markdown/defaults`
are still distributed in individual files. This is because inlining these
themes in files `markdown.tex`, `markdown.sty`, and `t-markdown.tex` would
make it more difficult for users to copy and modify these themes without
delaying updates to the Markdown package itself. Furthermore, these themes
are large and storing/executing them from an expl3 prop would make it more
difficult to determine the line numbers when errors occur.

Fixes:

Expand All @@ -18,7 +59,7 @@ Fixes:

Defaults:

- Define LaTeX renderers for table identifiers.
- Define default LaTeX renderer prototypes for table identifiers.
(#525, suggested by @machitgarha, #528)

This establishes a reliable method for authors to reference tables within
Expand Down Expand Up @@ -50,7 +91,7 @@ Defaults:
\end{document}
```

- Define LaTeX renderers for bracketed spans.
- Define default LaTeX renderer prototypes for bracketed spans.
(discussed with @MacLotsen at TUG 2024 and with @TeXhackse at matrix.org, #528)

This establishes a reliable method for authors to reference the last LaTeX
Expand Down Expand Up @@ -78,6 +119,44 @@ Defaults:
\end{document}
```

- Use package LuaXML in default LaTeX renderer prototypes for content blocks,
raw blocks, and inline raw spans. (#469, #532, co-authored by @michal-h21)

This allows authors to render HTML fragments in their LaTeX documents:

`````` tex
\documentclass{article}
\usepackage[content_blocks, raw_attribute]{markdown}
\begin{filecontents}[overwrite, nosearch, noheader]{example_input.html}
<b>foo</b> <i>bar</i>
\end{filecontents}
\begin{document}
\begin{markdown}
Raw text span: `<b>foo</b> <i>bar</i>`{=html}
Raw code block:
``` {=html}
<b>foo</b> <i>bar</i>
```
Content block:
/example_input.html
\end{markdown}
\end{document}
``````

Deprecation:

- Remove support for TeX Live 2022. (da85e015, 8f2d25c7)

This change also removes the Lua module `markdown-tinyyaml`, which has been
scheduled for removal ever since the Lua module `tinyyaml` was uploaded to
CTAN in TeX Live 2023.

## 3.8.1 (2024-11-03)

Fixes:
Expand Down
18 changes: 7 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ FROM $FROM_IMAGE:$TEXLIVE_TAG as build
ARG DEPENDENCIES
ARG TEXLIVE_DEPENDENCIES

ARG BINARY_DIR
ARG BUILD_DIR
ARG INSTALL_DIR
ARG PREINSTALLED_DIR
Expand Down Expand Up @@ -102,6 +103,7 @@ rm -rfv ${PREINSTALLED_DIR}/scripts/markdown/
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

# Uninstall the distribution lt3luabridge package
rm -rfv ${PREINSTALLED_DIR}/tex/generic/lt3luabridge/
Expand All @@ -113,22 +115,21 @@ mkdir -p ${INSTALL_DIR}/tex/
cp ${BUILD_DIR}/markdown.lua ${INSTALL_DIR}/tex/luatex/markdown/
cp ${BUILD_DIR}/markdown-parser.lua ${INSTALL_DIR}/tex/luatex/markdown/
cp ${BUILD_DIR}/markdown-unicode-data.lua ${INSTALL_DIR}/tex/luatex/markdown/
cp ${BUILD_DIR}/libraries/markdown-tinyyaml.lua ${INSTALL_DIR}/tex/luatex/markdown/
mkdir -p ${INSTALL_DIR}/scripts/markdown/
cp ${BUILD_DIR}/markdown-cli.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_tilde.tex ${INSTALL_DIR}/tex/generic/markdown/
cp ${BUILD_DIR}/markdownthemewitiko_markdown_defaults.tex ${INSTALL_DIR}/tex/generic/markdown/
mkdir -p ${INSTALL_DIR}/tex/latex/markdown/
cp ${BUILD_DIR}/markdown.sty ${INSTALL_DIR}/tex/latex/markdown/
cp ${BUILD_DIR}/markdownthemewitiko_dot.sty ${INSTALL_DIR}/tex/latex/markdown/
cp ${BUILD_DIR}/markdownthemewitiko_graphicx_http.sty ${INSTALL_DIR}/tex/latex/markdown/
cp ${BUILD_DIR}/markdownthemewitiko_markdown_defaults.sty ${INSTALL_DIR}/tex/latex/markdown/
mkdir -p ${INSTALL_DIR}/tex/context/third/markdown/
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
ln -s ${INSTALL_DIR}/scripts/markdown/markdown-cli.lua ${BINARY_DIR}/markdown-cli

# Install the current lt3luabridge package
git clone https://github.com/witiko/lt3luabridge.git
cd lt3luabridge
Expand Down Expand Up @@ -225,6 +226,7 @@ rm -rfv ${PREINSTALLED_DIR}/scripts/markdown/
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

# Uninstall the distribution lt3luabridge package
rm -rfv ${PREINSTALLED_DIR}/tex/generic/lt3luabridge/
Expand All @@ -234,20 +236,14 @@ EOF
# Install the Markdown package and the current lt3luabridge package
COPY --from=build ${BUILD_DIR}/dist ${INSTALL_DIR}/

COPY <<EOF ${BINARY_DIR}/markdown-cli
#!/bin/bash
texlua ${INSTALL_DIR}/scripts/markdown/markdown-cli.lua eagerCache=false \"\$@\"
echo
EOF

RUN <<EOF

set -o errexit
set -o nounset
set -o xtrace

# Make the markdown-cli script executable
chmod +x ${BINARY_DIR}/markdown-cli
ln -s ${INSTALL_DIR}/scripts/markdown/markdown-cli.lua ${BINARY_DIR}/markdown-cli

# Generate the ConTeXt file database
if echo ${TEXLIVE_TAG} | grep -q latest-minimal
Expand Down
Loading

0 comments on commit 90191a5

Please sign in to comment.