Skip to content

simply-logical/pandoc_filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Custom Pandoc Filters

Custom pandoc filters for converting LaTeX to quarto markdown.

Usage

To see the pandoc abstract syntax tree (AST):

pandoc test.tex -f latex+raw_tex -t native -o test.txt

To convert, first inject

\input{filter_markdown}

just above \begin{document} into the LaTeX file. Then, execute

pandoc test.tex -f latex+latex_macros -t markdown --lua-filter=filter_markdown.lua --wrap=preserve -o test.md

You can convert multiple files (do not specify the .tex extension) like so

batch=(
    file1
    file2
    file3
    ...
)
for item in "${batch[@]}"; do
    pandoc "${item}.tex" -f latex+latex_macros -t markdown --lua-filter=filter_markdown.lua --wrap=preserve -o "${item}.qmd"
done

Filters List

filter_latex.lua

Replaces LaTeX \customidx{param} with markdown {{< indexer add param >}}.

filter_markdown.lua

Replaces mlind and mldef LaTeX commands with the corresponding markdown syntax.

Build commands

Render the whole project

From the root directory of the repository render to LaTeX:

quarto render --to=latex

Render a specific file

From the root directory of the repository render to LaTeX:

quarto render ./file.qmd --log-level=info --to=html

Preview

Open the file:

open _book/file.html

Resources

API

Readers and Writers

Filters

About

Collection of pandoc filters

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published