{"id":33261021,"url":"https://github.com/michal-h21/make4ht","last_synced_at":"2025-12-17T14:46:30.859Z","repository":{"id":8674269,"uuid":"10332112","full_name":"michal-h21/make4ht","owner":"michal-h21","description":"Build system for tex4ht","archived":false,"fork":false,"pushed_at":"2025-10-01T12:58:31.000Z","size":1673,"stargazers_count":158,"open_issues_count":17,"forks_count":15,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-11-21T21:04:55.268Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michal-h21.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2013-05-28T09:25:43.000Z","updated_at":"2025-11-11T16:58:50.000Z","dependencies_parsed_at":"2023-10-02T18:02:19.893Z","dependency_job_id":"d55ec439-4e57-4de0-afe1-5c39161d55ad","html_url":"https://github.com/michal-h21/make4ht","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/michal-h21/make4ht","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michal-h21%2Fmake4ht","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michal-h21%2Fmake4ht/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michal-h21%2Fmake4ht/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michal-h21%2Fmake4ht/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michal-h21","download_url":"https://codeload.github.com/michal-h21/make4ht/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michal-h21%2Fmake4ht/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27783842,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-17T02:00:08.291Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-11-17T04:00:26.271Z","updated_at":"2025-12-17T14:46:30.839Z","avatar_url":"https://github.com/michal-h21.png","language":"Lua","funding_links":[],"categories":["LaTeX \u0026 PDF"],"sub_categories":[],"readme":"% [![Build Status](https://travis-ci.org/michal-h21/make4ht.svg?branch=master)](https://travis-ci.org/michal-h21/make4ht)\n% HTML version of the documentation can be found [here](https://www.kodymirus.cz/make4ht/make4ht-doc.html)\n\n# Introduction\n\n`make4ht` is a build system for [\\TeX4ht](https://tug.org/tex4ht/), \\TeX\\ to XML converter. It provides a command line tool\nthat drives the conversion process. It also provides a library that can be used to create\ncustomized conversion tools. An example of such a tool is\n[tex4ebook](https://github.com/michal-h21/tex4ebook), a tool for conversion from \\TeX\\ to\nePub and other e-book formats.\n\nSee section \\ref{sec:htlatex} for some reasons why you should consider to use `make4ht` instead \nof `htlatex`, section \\ref{sec:output} talks about supported output formats and extensions and section \\ref{sec:buildfiles} \ndescribes build files, which can be used to execute additional commands or post-process the generated files.\n\n\n\n# Usage\n\nThe basic conversion from \\LaTeX\\ to `HTML` using `make4ht` can be executed using the following command:\n\n    $ make4ht filename.tex\n\nIt will produce a file named `filename.html` if the compilation goes without fatal errors.\n\n## Command line options {#clioptions}\n\\label{sec:clioptions}\n\n    make4ht - build system for TeX4ht\n    Usage:\n    make4ht [options] filename [\"tex4ht.sty op.\" \"tex4ht op.\" \n         \"t4ht op\" \"latex op\"]\n    -a,--loglevel (default status) Set log level.\n                possible values: debug, info, status, warning, error, fatal\n    -b,--backend (default tex4ht) Backend used for xml generation.\n         possible values: tex4ht or lua4ht\n    -c,--config (default xhtml) Custom config file\n    -d,--output-dir (default \"\")  Output directory\n    -B,--build-dir (default nil)  Build directory\n    -e,--build-file (default nil)  If the build filename is different \n         than `filename`.mk4\n    -f,--format  (default nil)  Output file format\n    -j,--jobname (default nil)  Set the jobname\n    -l,--lua  Use lualatex for document compilation\n    -m,--mode (default default) Switch which can be used in the makefile\n    -n,--no-tex4ht  Disable DVI file processing with tex4ht command\n    -s,--shell-escape Enables running external programs from LaTeX\n    -u,--utf8  For output documents in utf8 encoding\n    -x,--xetex Use xelatex for document compilation\n    -v,--version  Print version number\n    \u003cfilename\u003e (string) Input filename\n\n## Option handling\n\nIt is possible to invoke `make4ht` in the same way as `htlatex`:\n\n    $ make4ht filename \"customcfg, charset=utf-8\" \"-cunihtf -utf8\" \"-dfoo\"\n\nNote that this will not use `make4ht` routines for the output directory handling. \nSee section \\ref{sec:output-dir} for more information about this issue.\nTo use these routines, change the previous listing to:\n\n    $ make4ht -d foo filename \"customcfg, charset=utf-8\" \"-cunihtf -utf8\"\n\nThis call has the same effect as the following:\n\n    $ make4ht -u -c customcfg -d foo filename\n\n\nOutput directory does not have to exist, it `make4ht` creates it automatically. \nSpecified path can be relative to the current directory, or absolute:\n\n    $ make4ht -d use/current/dir/ filename\n    $ make4ht -d ../gotoparrentdir filename\n    $ make4ht -d ~/gotohomedir filename\n    $ make4ht -d c:\\documents\\windowspathsareworkingtoo filename\n\nThe short options that do not take parameters can be collapsed:\n\n\n    $ make4ht -ulc customcfg -d foo filename\n\n## Input from the standard input\n\n\nTo pass the output from other commands to `make4ht`, use the `-` character as a\nfilename. It is best to use this feature together with the `--jobname` or `-j`\noption.\n\n    $ cat hello.tex | make4ht -j world -\n\n## Change amount of information printed on the command line\n\nBy default, `make4ht` tries to be quiet, so it hides most of the command line\nmessages and output from the executed commands. It displays status\nmessages, warnings, and errors. The logging level can be selected using the\n`--loglevel` or `-a` options. If the compilation fails, it may be useful to display more \ninformation using the `info` or `debug` levels. \n\n\n    $ make4ht -a debug faulty.tex\n\n\n\n# Difference of `make4ht` from  `htlatex` \n\\label{sec:htlatex}\n\n\n\\TeX4ht\\ system supports several output formats, most notably `XHTML`, `HTML 5`\nand `ODT`, but it also supports `TEI` or `Docbook`.\n\nThe conversion can be invoked using several scripts, which are distributed with \\TeX4ht.\nThey differ in parameters passed to the underlying commands.\n\nThese scripts invoke \\LaTeX\\ or Plain \\TeX\\ with special instructions to load\nthe `tex4ht.sty` package. The \\TeX\\ run produces a special `DVI` file \nthat contains the code for the desired output format. The produced `DVI` file\nis then processed using the `tex4ht` command, which in conjunction with the\n`t4ht` command produces the desired output files.\n\n## Passing of command line arguments to low-level commands used in the conversion\n\nThe basic conversion script provided by \\TeX4ht\\ system is named `htlatex`. It  compiles \\LaTeX\\  \nfiles to `HTML` with this command sequence:\n\n    $ latex $latex_options 'code for loading tex4ht.sty \\input{filename}'\n    $ latex $latex_options 'code for loading tex4ht.sty \\input{filename}'\n    $ latex $latex_options 'code for loading tex4ht.sty \\input{filename}'\n    $ tex4ht $tex4ht_options filename\n    $ t4ht $t4ht_options filename\n\nThe options for various parts of the system can be passed on the command line:\n\n    $ htlatex filename \"tex4ht.sty options\" \"tex4ht_options\" \"t4ht_options\" \"latex_options\"\n\nFor basic `HTML` conversion it is possible to use the most basic invocation:\n\n    $ htlatex filename.tex\n\nIt can be much more involved for the `HTML 5` output in `UTF-8` encoding:\n\n    $ htlatex filename.tex \"xhtml,html5,charset=utf-8\" \" -cmozhtf -utf8\"\n\n`make4ht` can simplify it:\n\n    $ make4ht -u filename.tex\n\nThe `-u` option requires the `UTF-8` encoding. `HTML 5` is used as the default\noutput format by `make4ht`.\n\nMore information about the command line arguments can be found in section\n\\ref{sec:clioptions}.\n\n\n## Compilation sequence\n\n`htlatex` has a fixed compilation order and a hard-coded number of \\LaTeX\\ invocations. \n\nIt is not possible to execute additional commands during the compilation.\nWhen we want to run a program that interacts with \\LaTeX, such as `Makeindex`\nor `Bibtex`, we have two options. The first option is to create a new script based on\n`htlatex` and add the wanted commands to the modified script. The second option\nis to execute `htlatex`, then the additional and then `htlatex` again. The\nsecond option means that \\LaTeX\\ will be invoked six times, as each call to\n`htlatex` executes three calls to \\LaTeX. This can lead to significantly long\ncompilation times. \n\n`make4ht` provides a solution for this issue using a build file, or extensions.\nThese can be used for interaction with external tools.\n\n`make4ht`  also provides compilation modes, which enables to select commands that\nshould be executed using a command line option.\n\nThere is a built-in `draft` mode, which invokes \\LaTeX\\ only once, instead of\nthe default three invocations.  It is useful for the compilations of the\ndocument before its final stage, when it is not important that  all\ncross-references work. It can save quite a lot of the compilation time:\n\n    $ make4ht -um draft filename.tex\n\nAnother buil-in mode is `clean`. It executes the `Make:clean()` command to\nremove all generated and temporary files from the current directory. \nNo \\LaTeX\\ compilation happens in this mode. \n\nIt should be used in this way:\n    \n    # copy generated files to a direcory\n    $ make4ht -d outdir filename.tex \n    # remove all generated files in the current dir\n    # the -a info option will print files that are removed\n    $ make4ht -m clean -a info filename.tex\n    \n\nMore information about the build files can be found in section \\ref{sec:buildfiles}.\n\n## Handling of the generated files\n\\label{sec:output-dir}\n\nThere are also issues with the behavior of the `t4ht` application. It reads the \n`.lg` file generated by the `tex4ht` command. This file contains\ninformation about the generated files, `CSS` instructions, calls to the external\napplications, instructions for image conversions, etc. \n\n\n`t4ht` can be instructed to copy the generated files to an output directory, but\nit doesn't preserve the directory structure. When the images are placed in a  \nsubdirectory, they will be copied to the output directory, losing the directory structure.\nLinks will be pointing to a non-existing subdirectory. The following command\nshould copy all output files to the correct destinations.\n\n    $ make4ht -d outputdir filename.tex\n\n`make4ht` can also output temporary files to a build directory, thanks to the `--build-dir` (or `-B`)\noption. The following command with put `.aux`, `.4tc` and other auxiliary files to the\n`build` dir, and the generated `.html` and `.css` files to the `outputdir` directory.\n\n    $ make4ht -B build -d outputdir filename.tex\n\n## Image conversion and postprocessing of the generated files\n\n\\TeX4ht\\ can convert parts of the document to images. This is useful \nfor diagrams or complicated math, for example.\n\nBy default, the image conversion is configured in a\n[`.env` file](https://www.tug.org/applications/tex4ht/mn34.html#mn35.html).\nIt has a bit of strange syntax,  with \noperating system dependent rules.\n`make4ht` provides simpler means for the image conversion in the build files.\nIt is possible to change the image conversion parameters without a need to modify the `.env` file.\nThe process is described in section \\ref{sec:imageconversion}.\n\nIt is also possible to post-process the generated output files. The post-processing can be done\neither using external programs such as `XSLT` processors and `HTML Tidy` or\nusing `Lua` functions. More information can be found in section \\ref{sec:postprocessing}.\n\n\n\n# Output file formats and extensions\n\\label{sec:output}\n\nThe default output format used by `make4ht` is `html5`. A different\nformat can be requested using the `--format` option. Supported formats are:\n\n - `xhtml`\n - `html5`\n - `odt`\n - `tei`\n - `docbook`\n\nThe `--format` option can be also used for extension loading.\n\n## Extensions\n\nExtensions can be used to modify the build process without the need to use a build file. They\nmay post-process the output files or request additional commands for the compilation.\n\nThe extensions can be enabled or disabled by appending `+EXTENSION` or `-EXTENSION` after\nthe output format name:\n\n     $ make4ht -f html5+tidy filename.tex\n\nIn `xhtml` and `html5` output formats, the `common_domfilters` extension is triggered automatically, but\nit can still be disabled using:\n\n     $ make4ht -f html5-common_domfilters filename.tex\n\n\nAvailable extensions:\n\n\ncommon\\_filters\n\n:    clean the output HTML files using filters.\n\ncommon\\_domfilters\n\n:    clean the HTML file using DOM filters. It is more powerful than\n     `common_filters`. It used following DOM filters: `fixinlines`, `idcolons`,\n     `joincharacters`, `mathmlfixes`, `tablerows`,`booktabs`, `sectionid`\n     and`itemparagraphs`\n\ncopy\\_images\n\n:    Copies the images to the output directory. This is useful if the original\n     images are stored in directories above the document directory.\n\ndetect\\_engine\n\n:    detect engine and format necessary for the document compilation from the\n     magic comments supported by \\LaTeX\\ editors such as TeXShop or TeXWorks. \n     Add something like the following line at the beginning of the main \\TeX\\ file:\n\n     `%!TEX TS-program = xelatex`\n\n     It supports also Plain \\TeX, use for example `tex` or `luatex` as the program name.\n\ndvisvgm\\_hashes\n\n:    efficient generation of SVG pictures using Dvisvgm. It can utilize\nmultiple processor cores and generates only changed images.\n\ninlinecss\n\n:    load the `inlinecss` DOM filter.\n\njoin\\_colors\n\n:    load the `joincolors` DOM filter for all HTML files.\n\nlatexmk\\_build\n\n:    use [Latexmk](https://ctan.org/pkg/latexmk?lang=en) for the \\LaTeX\\ compilation.\n\nmathjaxnode\n\n:    (**deprecated**, use `mjcli` extension instead) Old information: use [mathjax-node-page](https://github.com/pkra/mathjax-node-page/) to\n     convert from MathML code to HTML + CSS or SVG. See [the available\n     settings](#mathjaxsettings).\n\nmjcli\n\n:    use [mjcli](https://github.com/michal-h21/mjcli) to convert math in MathML or \\LaTeX\\ \n     format to plain HTML + CSS. MathML is used by default. If you want to use \\LaTeX\\ math,\n     add \"mathjax\" option on the command line (like `make4ht -f html5+mjcli filename.tex \"mathjax\"`).\n     See [the available settings](#mathjaxsettings).\n\nnodynamicodt \n\n:    change dynamic content in ODT files (such as tables of contents or bibliographies) to text.\n\nodttemplate\n\n:    it automatically loads the `odttemplate` filter (page \\pageref{sec:odttemplate}).\n\npreprocess\\_input \n\n:     compilation of the formats\n      supported by [Knitr](https://yihui.name/knitr/) (`.Rnw`, `.Rtex`, `.Rmd`, `.Rrst`) \n      and also Markdown and reStructuredText formats. It requires\n[R](https://www.r-project.org/) + [Knitr](https://yihui.name/knitr/)\ninstallation, it requires also [Pandoc](https://pandoc.org/) for formats based on Markdown or\nreStructuredText.\n\nstaticsite\n\n:    build the document in a form suitable for static site generators like [Jekyll](https://jekyllrb.com/).\n\ntidy\n\n:    clean the `HTML` files using the `tidy` command.\n\n# Build files\n\\label{sec:buildfiles}\n\n`make4ht` supports build files. These are `Lua` scripts that can adjust\nthe build process. They can request external applications like `BibTeX` or `Makeindex`,\npass options to the commands, modify the image conversion process, or post-process the\ngenerated files.\n\n`make4ht` tries to load default build file named as `filename + .mk4 extension`.\nIt is possible to select a different build file with `-e` or `--build-file` command line\noption.\n\nSample build file:\n\n    Make:htlatex()\n    Make:match(\"html$\", \"tidy -m -xml -utf8 -q -i ${filename}\")\n\n`Make:htlatex()` is preconfigured command for calling \\LaTeX\\ with the `tex4ht.sty` package\nloaded. In this example, it will be executed  only once. After the \ncompilation, the `tidy` command is executed on the output `HTML` files.\n\nNote that it is not necessary to call `tex4ht` and `t4ht` commands explicitly in the\nbuild file, they are called automatically. \n\n## User commands\n\nIt is possible to add more commands like `Make:htlatex` using the `Make:add` command:\n\n    Make:add(\"name\", \"command\", {settings table}, repetition)\n\nThis defines the `name` command, which can be then executed using `Make:name()`\ncommand in the build file. \n\nThe `name` and `command` parameters are required, the rest of the parameters are optional.\n\nThe defined command receives a table with settings as a parameter at the call time. \nThe default settings are provided by `make4ht`. Additional settings can be\ndeclared in the `Make:add` commands, user can also override the default settings\nwhen the command is executed in the build file:\n\n    Make:name({hello=\"world\"})\n\nMore information about settings, including the default settings provided by\n`make4ht`,  can be found in section \\ref{sec:settings} on page\n\\pageref{sec:settings}.\n\n\n### The `command` function\n\\label{sec:commandfunction}\n\nThe `command` parameter can be either a string template or function:\n\n    Make:add(\"text\", \"echo hello, input file: ${input}\")\n\nThe template can get a variable value from the parameters table using a\n`${var_name}` placeholder. Templates are executed using the operating system, so\nthey should invoke existing OS commands. \n\n\n\n\n\n### The `settings table` table\n\n\nThe `settings table` parameter is optional. If it is present, it should be\na table with new settings available in the command. It can also override the default\n`make4ht` settings for the defined command.\n\n    Make:add(\"sample_function\", function(params) \n      for k, v in pairs(params) do \n        print(k..\": \"..v) \n      end, {custom=\"Hello world\"}\n    )\n\n\n### Repetition\n\nThe `repetition` parameter  specifies the maximum number of executions of the\nparticular command.  This is used for instance for `tex4ht` and `t4ht`\ncommands, as they should be executed only once in the compilation. They would\nbe executed multiple times when they are included in the build file, as they\nare called by `make4ht` by default. Because these commands allow only one\n`repetition`, the second execution is blocked.\n\n### Expected exit code\n\nYou can set the expected exit code from a command with a `correct_exit` key in the\nsettings table. The compilation will be terminated when the command returns a\ndifferent exit code. \n\n    Make:add(\"biber\", \"biber ${input}\", {correct_exit=0})\n\nCommands that execute lua functions can return the numerical values using the `return` statement.\n\n\nThis mechanism isn't used for \\TeX, because it doesn't differentiate between fatal and non-fatal errors. \nIt returns the same exit code in all cases. Because of this, log parsing is used for a fatal error detection instead.\nError code value `1` is returned in the case of a fatal error, `0` is used\notherwise. The `Make.testlogfile` function can be used in the build file to\ndetect compilation errors in the TeX log file.\n\n\n## Provided commands\n\n`Make:htlatex`\n\n:    One call to the TeX engine with special configuration for loading of the `tex4ht.sty` package.\n\n`Make:autohtlatex`\n\n:    Variant of `Make:htlatex` that automates the compilation of \\LaTeX\\ documents, \n     ensuring that the process is repeated until the output stabilizes or an error occurs.\n\n`Make:clean`\n\n:    This command removes all generated files, including images, HTML files and\n     various auxilary files, from the current directory. It keeps files whose\n     file names don't match the input file name. It is preferable to use `make4ht -m clean filename.tex`\n     to clean output files.\n\n`Make:httex`\n\n:    Variant of `Make:htlatex` suitable for Plain \\TeX.\n\n`Make:latexmk`\n\n:    Use `Latexmk` for the document compilation. `tex4ht.sty` will be loaded automatically.\n\n`Make:tex4ht`\n\n:    Process the `DVI` file and create output files.\n\n`Make:t4ht`\n\n:    Create the CSS file and generate images.\n\n`Make:biber`\n\n:    Process bibliography using the `biber` command.\n\n`Make:pythontex`\n\n:    Process the input file using `pythontex`.\n\n`Make:bibtex`\n\n:    Process bibliography using the `bibtex` command.\n\n`Make:xindy`\n\n:    Generate index using Xindy index processor.\n\n`Make:makeindex`\n\n:    Generate index using the Makeindex command.\n\n`Make:xindex`\n\n:    Generate index using the Xindex command.\n\n\n## File matches\n\\label{sec:postprocessing}\n\nAnother type of action that can be specified in the build file is\n`Make:match`.  It can be used to post-process  the generated files:\n\n    Make:match(\"html$\", \"tidy -m -xml -utf8 -q -i ${filename}\")\n\nThe above example will clean all output `HTML` files using the `tidy` command.\n\nThe `Make:match` action tests output filenames using a `Lua` pattern matching function.  \nIt executes a command or a function, specified in the second argument, on files\nwhose filenames match the pattern. \n\nThe commands to be executed can be specified as strings. They can contain\n`${var_name}` placeholders, which are replaced with corresponding variables\nfrom the `settings` table. The templating system was described in \nsubsection \\ref{sec:commandfunction}. There is an additional variable\navailable in this table, called `filename`. It contains the name of the current\noutput file.\n\n\nIf a function is used instead, it will get two parameters.  The first one is the\ncurrent filename, the second one is the `settings` table. \n\n    Make:match(\"html$\", function(filename, settings)\n      print(\"Post-processing file: \".. filename)\n      print(\"Available settings\")\n      for k,v in pairs(settings)\n        print(k,v)\n      end\n      return true\n   end)\n\nMultiple post-processing actions can be executed on each filename. The Lua\naction functions can return an exit code. If the exit code is false, the execution\nof the post-processing chain for the current file will be terminated.\n\n### Filters\n\\label{sec:filters}\n\nTo make it easier to post-process the generated files using the `match`\nactions, `make4ht` provides a filtering mechanism thanks to the\n`make4ht-filter` module. \n\nThe `make4ht-filter` module returns a function that can be used for the filter\nchain building. Multiple filters can be chained into a pipeline. Each filter\ncan modify the string that is passed to it from the previous filters. The\nchanges are then saved to the processed file. \n\nSeveral built-in filters are available, it is also possible to create new ones.\n\nExample that use only the built-in filters:\n\n    local filter = require \"make4ht-filter\"\n    local process = filter{\"cleanspan\", \"fixligatures\", \"hruletohr\"}\n    Make:htlatex()\n    Make:match(\"html$\",process)\n\nFunction `filter` accepts also function arguments, in this case this function\ntakes file contents as a parameter and modified contents are returned.\n\nExample with custom filter:\n\n    local filter  = require \"make4ht-filter\"\n    local changea = function(s) return s:gsub(\"a\",\"z\") end\n    local process = filter{\"cleanspan\", \"fixligatures\", changea}\n    Make:htlatex()\n    Make:match(\"html$\",process)\n\nIn this example, spurious span elements are joined, ligatures are decomposed,\nand then all letters \"a\" are replaced with \"z\" letters.\n\nBuilt-in filters are the following:\n\ncleanspan\n\n:    clean spurious span elements when accented characters are used\n\ncleanspan-nat\n\n:    alternative clean span filter, provided by Nat Kuhn\n\nfixligatures\n\n:    decompose ligatures to base characters\n\nhruletohr\n\n:   `\\hrule` commands are translated to series of underscore characters\n    by \\TeX4ht, this filter translates these underscores to `\u003chr\u003e` elements\n\nentites\n\n:    convert prohibited named entities to numeric entities (only\n     `\u0026nbsp;` currently).\n\nfix-links\n\n:    replace colons in local links and `id` attributes with underscores. Some\n     cross-reference commands may produce colons in internal links, which results in\n     a validation error.\n\nmathjaxnode\n\n:    (**deprecated**, use `mjcli` extension instead) Old information: use [mathjax-node-page](https://github.com/pkra/mathjax-node-page/) to\n     convert from MathML code to HTML + CSS or SVG. See [the available\n     settings](#mathjaxsettings).\n\nmjcli\n\n:    use [mjcli](https://github.com/michal-h21/mjcli) to convert math in MathML or \\LaTeX\\ \n     format to plain HTML + CSS.  See [the available settings](#mathjaxsettings).\n\n\nodttemplate\n\n:    use styles from another `ODT` file serving as a template in the current\n     document. It works for the `styles.xml` file in the `ODT` file. During\n     the compilation, this file is named as `\\jobname.4oy`.\n     \\label{sec:odttemplate}\n\nstaticsite\n\n:    create HTML files in a format suitable for static site generators such as [Jekyll](https://jekyllrb.com/)\n\nsvg-height\n\n:    some  SVG images produced by `dvisvgm` seem to have wrong dimensions. This filter\n     tries to set the correct image size.\n\n\n### DOM filters\n\nDOM filters are variants of filters that use the\n[`LuaXML`](https://ctan.org/pkg/luaxml) library to modify\ndirectly the XML object. This enables more powerful\noperations than the regex-based filters from the previous section. \n\nExample:\n\n    local domfilter = require \"make4ht-domfilter\"\n    local process = domfilter {\"joincharacters\"}\n    Make:match(\"html$\", process)\n\n\nAvailable DOM filters:\n\naeneas\n\n:  [Aeneas](https://www.readbeyond.it/aeneas/) is a tool for automagical synchronization of text and audio.\n   This filter modifies the HTML code to support synchronization.\n\nbooktabs\n\n:  fix lines produced by the `\\cmidrule` command provided by the Booktabs package.\n\ncollapsetoc\n\n:  collapse table of contents to contain only top-level sectioning level and sections on the current page.\n\nfixinlines\n\n:  put all inline elements which are direct children of the `\u003cbody\u003e` elements to a paragraph.\n\nidcolons\n\n:  replace the colon (`:`) character in internal links and `id` attributes. They cause validation issues.\n\ninlinecss\n\n:  remove CSS rules that target elements with unique attributes, such as color boxes, table rules, or inline math pictures,\n   and insert their properties as a inline `style` attribute in the HTML document.\n\njoincharacters\n\n:  join consecutive `\u003cspan\u003e` or `\u003cmn\u003e` elements. This DOM filter supersedes the `cleanspan` filter.\n\njoincolors\n\n:  many `\u003cspan\u003e` elements with unique `id` attributes are created when \\LaTeX\\ colors are being used in the document.\n   A CSS rule is added for each of these elements, which may result in\n   substantial growth of the CSS file. This filter replaces these rules with a\n   common one for elements with the same color value. See also the `inlinecss` DOM filter and extension, which provides an\n   alternative using inline styles.\n\nodtfonts\n\n:  fix styles for fonts that were wrongly converted by `Xtpipes` in the ODT format.\n\nodtimagesize\n\n:  set correct dimensions for images in the ODT format. It is no longer used, as the dimensions are set by TeX4ht itself.\n\n\nodtpartable\n\n:  resolve tables nested inside paragraphs, which is invalid in the ODT format.\n\ntablerows\n\n:  remove spurious rows from HTML tables.\n\nmathmlfixes\n\n:  fix common issues for MathML.\n\nsectionid\n\n:  create `id` attribute for HTML sectioning elements derived from the section\n   title. It also updates links to these sections. Use the `notoc` command line\n   option to prevent that.\n\nt4htlinks\n\n:  fix hyperlinks in the ODT format.\n\n\n\n## Image conversion\n\\label{sec:imageconversion}\n\nIt is possible to convert parts of the \\LaTeX\\ input as pictures. It can be used\nfor preserving the appearance of  math or diagrams, for example. \n\nThese pictures are stored in a special `DVI` file, which can be processed by\na `DVI` to image commands, such as `dvipng` or `dvisvgm`. \n\nThis conversion is normally configured in the `tex4ht.env` file. This file\nis system dependent and it has quite an unintuitive syntax.\nThe configuration is processed by the `t4ht` application and the conversion\ncommand is called for all pictures.\n\nIt is possible to disable `t4ht` image processing and configure image\nconversion in the build file using the `image` action:\n\n    Make:image(\"png$\",\n    \"dvipng -bg Transparent -T tight -o ${output}  -pp ${page} ${source}\")\n\n\n`Make:image` takes two parameters, a `Lua` pattern to match the image name, and\nthe action.\n\nAction can be either a string template with the conversion command\nor a function that takes a table with parameters as an argument.\n\nThere are three parameters:\n\n  - `output` - output image filename\n  - `source` - `DVI` file with the pictures\n  - `page`   - page number of the converted image\n\n## The `mode` variable\n\nThe `mode` variable available in the build process contains \ncontents of the `--mode` command line option.  It can be used to run some commands\nconditionally. For example:\n\n     if mode == \"draft\" then\n       Make:htlatex{} \n     else\n       Make:htlatex{}\n       Make:htlatex{}\n       Make:htlatex{}\n     end\n\nIn this example (which is the default configuration used by `make4ht`),\n\\LaTeX\\ is called only once when `make4ht` is called with the `draft` mode:\n    \n    make4ht -m draft filename\n\n## The `settings` table\n\\label{sec:settings}\n\nIt is possible to access the parameters outside commands, file matches\nand image conversion functions. For example, to convert the document to\nthe `OpenDocument Format (ODT)`, the following settings can be used. They are\nbased on the `oolatex` command:\n\n    settings.tex4ht_sty_par = settings.tex4ht_sty_par ..\",ooffice\"\n    settings.tex4ht_par = settings.tex4ht_par .. \" ooffice/! -cmozhtf\"\n    settings.t4ht_par = settings.t4ht_par .. \" -cooxtpipes -coo \"\n\n(Note that it is possible to use the `--format odt` option\nwhich is superior to the previous code. This example is intended just as an\nillustration)\n\nThere are some functions to simplify access to the settings:\n\n`set_settings{parameters}`\n\n:   overwrite settings with values from a passed table\n\n`settings_add{parameters}`\n\n:   add values to the current settings \n\n`filter_settings \"filter name\" {parameters}`\n\n:   set settings for a filter\n\n`get_filter_settings(name)`\n\n:   get settings for a filter\n\n\nFor example, it is possible to simplify the sample from the previous code listings:\n\n    settings_add {\n      tex4ht_sty_par =\",ooffice\",\n      tex4ht_par = \" ooffice/! -cmozhtf\",\n      t4ht_par = \" -cooxtpipes -coo \"\n    }\n\nSettings for filters and extensions can be set using `filter_settings`:\n\n    \n    filter_settings \"test\" {\n      hello = \"world\"\n    }\n\nThese settings can be retrieved in the extensions and filters using the `get_filter_settings` function:\n\n    function test(input)\n       local options = get_filter_settings(\"test\")\n       print(options.hello)\n       return input\n    end\n       \n### Default settings\n\nThe default parameters are the following:\n\n`htlatex`\n\n:     used \\TeX\\ engine\n\n`input`\n\n:    content of `\\jobname`, see also the `tex_file` parameter.\n\n`interaction`\n\n:    interaction mode for the \\TeX\\ engine. The default value is `batchmode` to\n     suppress user input on compilation errors. It also suppresses most of the \\TeX\\ \n     compilation log output. Use the `errorstopmode` for the default behavior.\n\n`tex_file`\n\n:    input \\TeX\\ filename\n\n`latex_par`\n\n:    command line parameters to the \\TeX\\ engine\n\n`packages`\n\n:    additional \\LaTeX\\ code  inserted before `\\documentclass`.\n     Useful for passing options to packages used in the document or to load additional packages.\n\n`tex4ht_sty_par`\n\n:    options for `tex4ht.sty`\n\n`tex4ht_par`\n\n:     command line options for the `tex4ht` command\n\n`t4ht_par`\n\n:    command line options for the `t4ht` command\n\n`outdir`\n\n:    the output directory\n\n`correct_exit`\n\n:    expected `exit code` from the command. The compilation will be terminated\n     if the exit code of the executed command has a different value.\n\n`auto_extensions`\n\n:    table with extensions of auxiliary files that should be watched by the `Make:autohtlatex` command.\n\n`max_compilations`\n\n:    maximum number of \\LaTeX\\ runs by the `Make:autohtlatex` command.\n\n\n# `make4ht` configuration file {#configfile}\n\nIt is possible to globally modify the build settings using the configuration\nfile. It is a special version of a build file where the global settings can be set.\n\nCommon tasks for the configuration file can be a declaration of the new commands,\nloading of the default filters or specification of a default build sequence. \n\nOne additional functionality not available in the build files are commands for\nenabling and disabling of extensions.\n\n\n## Location \n\nThe configuration file can be saved either in the\n`$HOME/.config/make4ht/config.lua` file, or in the `.make4ht` file placed in\nthe current directory or it's parent directories (up to the `$HOME` directory). \n\n## Additional commands\n\nThere are two additional commands:\n\n`Make:enable_extension(name)`\n\n:  require extension\n\n`Make:disable_extension(name)`\n\n:  disable extension\n\n## Example\n\nThe following example of the configuration file adds support for the `biber` command, requires\n`common_domfilters` extension and requires MathML\noutput for math.\n\n    Make:add(\"biber\", \"biber ${input}\")\n    Make:enable_extension \"common_domfilters\"\n    settings_add {\n      tex4ht_sty_par =\",mathml\"\n    }\n\n\u003c!--\n# Development\n\n## Custom filters\n\n## New extensions\n\n## How to add a new output format\n\n--\u003e\n\n# List of available settings for filters and extensions.\n\nThese settings may be set using `filter_settings` function in a build file or in the `make4ht` configuration file.\n\n## Compilation commands\n\n## The `autohtlatex` command\n\nauto_extensions\n\n:    table with extensions of auxiliary files that should be watched by the `Make:autohtlatex` command.\n\nmax_compilations\n\n:    maximum number of \\LaTeX\\ runs by the `Make:autohtlatex` command.\n\n\n## Indexing commands\n\nThe indexing commands (like `xindy` or `makeindex`) use some common settings.\n\nidxfile\n\n:    name of the `.idx` file. Default value is `\\jobname.idx`.\n\nindfile\n\n:    name of the `.ind` file. Default value is the same as `idxfile` with the file extension changed to `.ind`.\n\nEach indexing command can have some additional settings.\n\n### The `xindy` command\n\nencoding\n\n:    text encoding of the `.idx` file. Default value is `utf8`.\n\nlanguage\n\n:    index language. Default language is English.\n\nmodules\n\n:    table with names of additional `Xindy` modules to be used.\n\n### The `makeindex` command\n\noptions\n\n:    additional command line options for the Makeindex command.\n\n### The `xindex` command\n\noptions\n\n:    additional command line options for the Xindex command.\n\nlanguage\n\n:    document language\n\n## The `tidy` extension\n\noptions\n\n:  command line options for the `tidy` command. Default value is `-m -utf8 -w 512 -q`.\n\n## The `collapsetoc` dom filter\n\n`toc_query` \n\n:  CSS selector for selection of element that contains the table of contents. \n\n`title_query`\n\n:  CSS selector for selecting all elements that contain the section ID attribute.\n\n`toc_levels` \n\n:  table containing a hierarchy of classes used in TOC\n\n`max_depth`\n\n:  set detph of displayed children TOC levels\n\nDefault values:\n\n    filter_settings \"collapsetoc\" {\n      toc_query = \".tableofcontents\",\n      title_query = \"h1 a, h2 a, h3 a, h4 a, h5 a, h6 a\",\n      max_depth = 1,\n      toc_levels = {\n        tocpart = 1,\n        toclikepart = 1,\n        tocappendix = 1,\n        toclikechapter = 2,\n        tocchapter = 2,\n        tocsection = 3,\n        toclikesection = 3,\n        tocsubsection = 4,\n        toclikesubsection = 4,\n        tocsubsubsection = 5,\n        toclikesubsubsection = 5,\n        tocparagraph = 6,\n        toclikeparagraph = 6,\n        tocsubparagraph = 7,\n        toclikesubparagraph = 7,\n      }\n    }\n\n## The `copy_images` extension\n\nextensions\n\n:  table with list of image extensions that should be processed. \n\n\nimg\\_dir\n\n:  name of the output directory where images should be stored\n\nDefault values:\n\n     filter_settings \"copy_images\" {\n        extensions = {\"png\", \"jpg\", \"jpeg\", \"svg\"},\n        img_dir = \"\"\n     }\n\n## The `fixinlines` dom filter \n\ninline\\_elements\n\n:  table of inline elements that shouldn't be direct descendants of the `body` element. The element names should be table keys, the values should be true.\n\nExample\n\n    filter_settings \"fixinlines\" {inline_elements = {a = true, b = true}}\n\n## The `joincharacters` dom filter\n\ncharclasses \n\n:  table of elements that should be concatenated when two or more of such elements with the same value of the `class` attribute are placed one after another.\n\nExample\n\n    filter_settings \"joincharacters\" { charclasses = { span=true, mn = true}}\n\n## The `mjcli` filter and extension {#mathjaxsettings}\n\n`mjcli` detects whether to use MathML or \\LaTeX\\ input by use of the `mathjax` option for `make4ht`. By default, it uses MathML. \\LaTeX\\ input can be required using:\n\n    make4ht -f html5+mjcli filename.tex \"mathjax\"\n\n### Available settings\n\noptions\n\n:  command line options for the `mjcli` command. \n\nExample\n\n    filter_settings \"mjcli\" {\n      options=\"--svg\"\n    }\n\ncssfilename  \n\n:  the `mjcli` command puts some CSS code into the HTML pages. The `mjcli` filter extracts this information and saves it to a standalone CSS file. Default name of this CSS file is `${input}-mathjax.css`\n\nfontdir\n\n:  directory with MathJax font files. This option enables the use of local fonts, which\n   is useful in the conversion to ePub, for example. The font directory should be\n   sub-directory of the current directory. Only \\TeX\\ font is supported at the moment.\n\nExample\n\n\n    filter_settings \"mjcli\" {\n      fontdir=\"fonts/TeX/woff/\" \n    }\n\n\n## The `staticsite` filter and extension\n\nsite\\_root \n\n:  directory where generated files should be copied.\n\nmap\n\n:  a hash table where keys contain patterns that match filenames and values contain\ndestination directory for the matched files. The destination directories are\nrelative to the `site_root` (it is possible to use `..` to switch to a parent\ndirectory).\n\nfile\\_pattern \n\n:  a pattern used for filename generation. It is possible to use string templates\nand format strings for `os.date` function. The default pattern `%Y-%m-%d-${input}`\ncreates names in the form of `YYYY-MM-DD-file_name`.\n\nheader\n\n:  table with variables to be set in the YAML header in HTML files. If the\ntable value is a function, it is executed with current parameters and HTML page\nDOM object as arguments.\n\nremove\\_maketitle\n\n:  the `staticsite` extension removes text produced by the `\\maketitle` command by default. Set this \noption to `false` to disable the removal.\n\nExample:\n\n\n    -- set the environmental variable 'blog_root' with path to \n    -- the directory that should hold the generated HTML files\n    local outdir = os.getenv \"blog_root\" \n    \n    filter_settings \"staticsite\" {\n      site_root = outdir, \n      map = {\n        [\".css$\"] = \"/css/\"\n      },\n      header = {\n         layout=\"post\",\n         date = function(parameters, dom)\n           return os.date(\"!%Y-%m-%d %T\", parameters.time)\n         end\n      }\n    }\n\n## The `dvisvgm_hashes` extension\n\noptions\n\n:  command line options for Dvisvgm. The default value is `-n --exact -c ${scale},${scale}`.\n\ncpu_cnt\n\n:  the number of processor cores used for the conversion. The extension tries to detect the available cores automatically by default.\n\nmake_command\n\n:  variant of the `make` command used for the parallel conversion of large\nnumber of pages. It receives tvo variables, `process_count` and `make_file`.\nDefault value is \"make -j ${process_count} -f ${make_file}\".\n\ntest_make_command\n\n:  command that tests if the selected variant of the `make` command exists. Default value is `make -v`.\n\n\nparallel_size\n\n:  the number of pages used in each Dvisvgm call. The extension detects changed\npages in the DVI file and constructs multiple calls to Dvisvgm with only changed\npages.\n\nscale\n\n:  amount of SVG scaling. The default value is 1.4.\n\n## The `odttemplate` filter and extension\n\ntemplate\n\n:  filename of the template `ODT` file \n\n\n`odttemplate` can also get the template filename from the `odttemplate` option from `tex4ht_sty_par` parameter. It can be set using the following command line call:\n\n     make4ht -f odt+odttemplate filename.tex \"odttemplate=template.odt\"\n\n## The `aeneas` filter\n\nskip\\_elements\n\n:  List of CSS selectors that match elements that shouldn't be processed. Default value: `{ \"math\", \"svg\"}`.\n\nid\\_prefix \n\n:  prefix used in the ID attribute forming.\n\nsentence\\_match \n\n:  Lua pattern used to match a sentence. Default value: `\"([^%.^%?^!]*)([%.%?!]?)\"`.\n\n## The  `make4ht-aeneas-config` package\n\nCompanion for the `aeneas` DOM filter is the `make4ht-aeneas-config` plugin. It\ncan be used to write the Aeneas configuration file or execute Aeneas on the\ngenerated HTML files.\n\nAvailable functions:\n\nwrite\\_job(parameters)\n\n:  write Aenas job configuration to `config.xml` file. See the [Aeneas\n   documentation](https://www.readbeyond.it/aeneas/docs/clitutorial.html#processing-jobs)\n   for more information about jobs.\n\nexecute(parameters)\n\n:  execute Aeneas.\n\nprocess\\_files(parameters)\n\n:  process the audio and generated subtitle files.\n\n\nBy default, a `SMIL` file is created. It is assumed that there is an audio file\nin the `mp3` format, named as the \\TeX\\ file. It is possible to use different formats\nand filenames using mapping.\n\nThe configuration options can be passed directly to the functions or set using\n`filter_settings \"aeneas-config\" {parameters}` function.\n\n\n### Available parameters\n\n\nlang \n\n:  document language. It is interfered from the HTML file, so it is not necessary to set it. \n\nmap \n\n:  mapping between HTML, audio and subtitle files. More info below. \n\ntext\\_type \n\n:  type of input. The `aeneas` DOM filter produces an `unparsed` text type.\n\nid\\_sort \n\n:  sorting of id attributes. The default value is `numeric`.\n\nid\\_regex \n\n:  regular expression to parse the id attributes.\n\nsub\\_format \n\n:  generated subtitle format. The default value is `smil`.\n\n\n### Additional parameters for the job configuration file\n\n- description \n- prefix \n- config\\_name \n- keep\\_config \n\n\n\nIt is possible to generate multiple HTML files from the \\LaTeX\\ source. For\nexample, `tex4ebook` generates a separate file for each chapter or section. It is\npossible to set options for each HTML file, in particular names of the\ncorresponding audio files. This mapping is done using the `map` parameter. \n\nExample:\n\n    filter_settings \"aeneas-config\" {\n      map = {\n        [\"sampleli1.html\"] = {audio_file=\"sample.mp3\"}, \n        [\"sample.html\"] = false\n      }\n    }\n\nTable keys are the configured filenames. It is necessary to insert them as\n`[\"filename.html\"]`, because of Lua syntax rules.\n\nThis example maps audio file `sample.mp3` to a section subpage. The main HTML\nfile, which may contain title and table of contents doesn't have a\ncorresponding audio file.\n\nFilenames of the subfiles correspond to the chapter numbers, so they are not\nstable when a new chapter is added. It is possible to request filenames\nderived from the chapter titles using the `sec-filename` option for `tex4ht.sty`.\n\n### Available `map` options\n\n\naudio\\_file \n\n:  the corresponding audio file \n\nsub\\_file \n\n:  name of the generated subtitle file\n\nThe following options are the same as their counterparts from the main parameters table and generally, don't need to be set:\n\n- prefix \n- file\\_desc \n- file\\_id \n- text\\_type \n- id\\_sort\n- id\\_prefix \n- sub\\_format \n\n\n### Full example\n\n\n    local domfilter = require \"make4ht-domfilter\"\n    local aeneas_config = require \"make4ht-aeneas-config\"\n    \n    filter_settings \"aeneas-config\" {\n      map = {\n        [\"krecekli1.xhtml\"] = {audio_file=\"krecek.mp3\"}, \n        [\"krecek.xhtml\"] = false\n      }\n    }\n    \n    local process = domfilter {\"aeneas\"}\n    Make:match(\"html$\", process)\n\n    if mode == \"draft\" then\n      aeneas_config.process_files {}\n    else\n      aeneas_config.execute {}\n    end\n\n\n\n\n# Troubleshooting \n\n## Incorrect handling of command line arguments for `tex4ht`, `t4ht` or `latex`\n\nSometimes, you may get a similar error:\n\n    make4ht:unrecognized parameter: i\n\nIt may be caused by a following `make4ht` invocation:\n\n    $ make4ht hello.tex \"customcfg,charset=utf-8\" \"-cunihtf -utf8\" -d foo\n\nThe command line option parser is confused by mixing options for `make4ht` and\n\\TeX4ht\\ in this case. It tries to interpret the `-cunihtf -utf8`, which are\noptions for the `tex4ht` command, as `make4ht` options. To fix that, try to\nmove the `-d foo` directly after the `make4ht` command:\n\n    $ make4ht -d foo hello.tex \"customcfg,charset=utf-8\" \"-cunihtf -utf8\"\n\nAnother option is to add a space before the `tex4ht` options:\n\n    $ make4ht hello.tex \"customcfg,charset=utf-8\" \" -cunihtf -utf8\" -d foo\n\nThe former way is preferable, though.\n\n## Table of Contents points to a wrong destination\n\nThe `sectionid` DOM filter creates better link destinations for sectioning commands.\nIn some cases, for example if you use Pandoc, the document may already contain the\nlink destination with the same name. In such cases the original destination is preserved \nin the file. In this case links to the section will point to that place, instead of\ncorrect destination in the section. This may happen for example if you use Pandoc for\nthe Markdown to \\LaTeX\\ conversion. It creates `\\hypertarget` commands that are placed \njust before section. The links points to that place, instead of the actual section. \n\nIn this case you don't want to update links. Use the `notoc` option to prevent that.\n\n\n\n## Filenames containing spaces\n\n`tex4ht` command cannot handle filenames containing spaces. to fix this issue, `make4ht` \nreplaces spaces in the input filenames with underscores. The generated\nXML filenames use underscores instead of spaces as well.\n\n## Filenames containing non-ASCII characters\n\nThe `odt` output doesn't support accented filenames, it is best to stick to ASCII characters in filenames.\n\n# License\n\nPermission is granted to copy, distribute and/or modify this software\nunder the terms of the LaTeX Project Public License, version 1.3.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichal-h21%2Fmake4ht","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichal-h21%2Fmake4ht","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichal-h21%2Fmake4ht/lists"}