lkmpg
lkmpg copied to clipboard
Use GitHub Actions for site building and format conversion.
There are a bunch of static site generator that creates HTML pages from templates or components and the given content source. Besides, we can also automate, customize, and execute workflows right in the repository with GitHub Actions.
The OI Wiki Project is an example:
- The contents are written in Markdown.
- Then the
buildandbuild-pdfworkflows are triggered whenever there is any push or pull request event.buildworkflow runsmkdocsfor creating HTML pages from*.mdfiles.build-pdfworkflow coverted*.mdfiles to*.texfiles (by running this JavaScript script) and compiled them tooutput.pdf.
Besides, the site 《大家來學 LaTeX》 is another site created with Hugo and use utteranc as the comment system. It would be a possible solution to use pandoc for coverting *.tex to *.md.
make4ht is used for HTML generation (#20), and I would like to stick to LaTeX script at present.
Sure that we can keep the source files in *.tex format but find out another solution for HTML/EPUB generating. It's not really convenient to use TeX4ht with custom HTML template although it's enough at present.
I think build a markdown file then convert it into html sounds promising.
However pandoc doesn't support some extensions used in lkmpg.tex and caused several code blocks to be omitted.
More packages make more possible dependency issue but we don't have bunch of packages.
I've check that currently the format conversion of code block from tex to md would be like something below:
| LaTeX | Markdown |
|
|
It seems that we can do something tricky: TeX -> Markdown -> HTML. Just replace ":::" with "```" and "codebash" (or something else programming languages) with "bash" before converting to HTML from Markdown.
Also, I found that we can use listings package instead of minted in LaTeX and pandoc handle the lstlisting environment well.

After creating and running with a custom pandoc filter for minted package. Now it can handle the code block environment with minted package well:

It may take me some time for creating the pandoc filter to deal with the \newminted[codebash] environment that @jserv created.
Consider using \begin{minted}[linenos]{c} instead of \begin{minted}{c} so the line number can be shown.
There is a POC (Proof of Concept) site building with Pandoc + Hugo (theme: book) could be check at here. It seems that:
- The lua-filters
mintedgiven by Pandoc officially could not deal with the[linenos]options well. And I need to modify it for custom use. - The
\samplec{}macro for including*.csource code into document is not work when converting withpandoc. This could be resolve with hardcoded replacing before converting.
Now, waiting for #26 resolved so that I could split one page into several chapters.