diff --git a/build.sh b/build.sh index ac2e207..cfb879f 100755 --- a/build.sh +++ b/build.sh @@ -265,6 +265,7 @@ if [ -n "${pdf_output}" ]; then --template=eisvogel.latex \ --filter=mermaid-filter \ --filter=pandoc-crossref \ + --lua-filter=parse-html.lua \ --resource-path=.:/resources \ --data-dir=/resources \ --top-level-division=section \ @@ -279,7 +280,7 @@ if [ -n "${pdf_output}" ]; then --metadata=titlepage-rule-height:0 \ --metadata=colorlinks:true \ --metadata=contact:admin@trustedcomputinggroup.org \ - --from=markdown+implicit_figures+grid_tables+table_captions-citations \ + --from=markdown+implicit_figures+grid_tables+table_captions-citations-markdown_in_html_blocks \ ${extra_pandoc_options} \ --to=pdf \ "${build_dir}/${input_file}.3" \ @@ -296,6 +297,7 @@ if [ -n "${latex_output}" ]; then --template=eisvogel.latex \ --filter=mermaid-filter \ --filter=pandoc-crossref \ + --lua-filter=parse-html.lua \ --resource-path=.:/resources \ --data-dir=/resources \ --top-level-division=section \ @@ -310,7 +312,7 @@ if [ -n "${latex_output}" ]; then --metadata=titlepage-rule-height:0 \ --metadata=colorlinks:true \ --metadata=contact:admin@trustedcomputinggroup.org \ - --from=markdown+implicit_figures+grid_tables+table_captions-citations \ + --from=markdown+implicit_figures+grid_tables+table_captions-citations-markdown_in_html_blocks \ ${extra_pandoc_options} \ --to=latex \ "${build_dir}/${input_file}.3" \ @@ -327,9 +329,10 @@ if [ -n "${docx_output}" ]; then --filter=/resources/filters/info.py \ --filter=mermaid-filter \ --filter=pandoc-crossref \ + --lua-filter=parse-html.lua \ --resource-path=.:/resources \ --data-dir=/resources \ - --from=markdown+implicit_figures+grid_tables+table_captions-citations \ + --from=markdown+implicit_figures+grid_tables+table_captions-citations-markdown_in_html_blocks \ --reference-doc=/resources/templates/tcg_template.docx \ ${extra_pandoc_options} \ --to=docx \ diff --git a/filter/parse-html.lua b/filter/parse-html.lua new file mode 100644 index 0000000..d1f6524 --- /dev/null +++ b/filter/parse-html.lua @@ -0,0 +1,8 @@ +-- https://tex.stackexchange.com/questions/631243/how-to-render-html-tables-in-markdown-using-pandoc + +function RawBlock (raw) + return raw.format:match 'html' + and pandoc.read(raw.text, 'html').blocks + or raw + end + \ No newline at end of file diff --git a/sample3.md b/sample3.md index 962a28d..71527eb 100644 --- a/sample3.md +++ b/sample3.md @@ -148,6 +148,46 @@ This section contains a Grid Table. | Earth | -89.2 | 14 | 56.7 | +---------------------+-------+-------+-------+ +### HTML Table + +This section contains an HTML Table. + +
A || B | +concatenation of B to A | +
---|---|
CEIL(x) | +the smallest integer not less than x | +
FLOOR(x) | +the largest integer not greater than x | +
A $\coloneqq$ B | +assignment of the results of the expression on the right (B) to the +parameter on the left | +
A = B | +equivalence (A is the same as B) | +
{ A } | +an optional element | +