Open Hsins opened 3 years ago
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 |
```plain \subsection{Kernel module package} \label{sec:packages} Linux distributions provide the commands \emph{modprobe}, \emph{insmod} and \emph{depmod} within a package. On Ubuntu/Debian: \begin{codebash} sudo apt-get install build-essential kmod \end{codebash} ``` | ```plain ## Kernel module package {#sec:packages} Linux distributions provide the commands *modprobe*, *insmod* and *depmod* within a package. On Ubuntu/Debian: ::: codebash sudo apt-get install build-essential kmod ::: ``` |
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:
minted
given by Pandoc officially could not deal with the [linenos]
options well. And I need to modify it for custom use.\samplec{}
macro for including *.c
source code into document is not work when converting with pandoc
. This could be resolve with hardcoded replacing before converting.Now, waiting for #26 resolved so that I could split one page into several chapters.
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:
build
andbuild-pdf
workflows are triggered whenever there is any push or pull request event.build
workflow runsmkdocs
for creating HTML pages from*.md
files.build-pdf
workflow coverted*.md
files to*.tex
files (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
.