Word and Markdown
docx filldocx filldocx placeholdersdocx to_textdocx to_textdocx to_markdowndocx tablesdocx tablesdocx infodocx createdocx createmarkdown to_htmlmarkdown to_htmlmarkdown to_textmarkdown to_docxmarkdown to_docxmarkdown from_html

docx fill <template> <out_path> <json_data>


Description

    Fill a template and write the result. Returns {out_path, replaced (values and images inserted), unresolved (names without a value, and invalid placeholders such as {{a b}} which stay as they are)}. An unknown placeholder becomes empty and an unknown section false. An image is given by {"path": ..., "width": pixels, "height": pixels}, or its path alone: png, jpg or gif, the ratio is kept when only one size is given, the size of the file when none

Parameters

    template:   The .docx template - String - required
    out_path:   The .docx file to write (the folders are created) - String - required
    json_data:   The values: a JSON object - String - required
admin
if (equal (file exist "tmp/tuto_office") "0") {file mkdir "tmp/tuto_office";}; docx create "tmp/tuto_office/tpl.docx" "[{\"type\": \"heading\", \"level\": 1, \"text\": \"Invoice {{number}}\"}, {\"type\": \"paragraph\", \"text\": \"Customer: {{customer.name}}, {{customer.city}}\"}, {\"type\": \"table\", \"header\": [\"Item\", \"Qty\", \"Price\"], \"rows\": [[\"{{#lines}}{{item}}\", \"{{qty}}\", \"{{price}}{{/lines}}\"], [\"Total\", \"\", \"{{total}}\"]]}, {\"type\": \"paragraph\", \"text\": \"{{?paid}}Paid, thank you.{{/paid}}{{^paid}}Payment due within 30 days.{{/paid}}\"}]"; docx fill "tmp/tuto_office/tpl.docx" "tmp/tuto_office/out.docx" "{\"number\": \"F-2026-042\", \"customer\": {\"name\": \"Atelier Payet\", \"city\": \"Saint-Denis\"}, \"lines\": [{\"item\": \"Pen\", \"qty\": 2, \"price\": 3.5}, {\"item\": \"Ink\", \"qty\": 1, \"price\": 12}], \"total\": 19, \"paid\": false}"; -> "[res]" (docx to_text "tmp/tuto_office/out.docx"); file delete "tmp/tuto_office"; [res]
mentdb
Invoice F-2026-042 Customer: Atelier Payet, Saint-Denis Item Qty Price Pen 2 3.5 Ink 1 12 Total 19 Payment due within 30 days.
Complete: the returned JSON, one placeholder without value
admin
if (equal (file exist "tmp/tuto_office") "0") {file mkdir "tmp/tuto_office";}; docx create "tmp/tuto_office/t.docx" "[{\"type\": \"paragraph\", \"text\": \"{{known}} and {{unknown}}\"}]"; -> "[res]" (docx fill "tmp/tuto_office/t.docx" "tmp/tuto_office/o.docx" "{\"known\": \"A\"}"); file delete "tmp/tuto_office"; [res]
mentdb
{"out_path": "tmp/tuto_office/o.docx", "replaced": 1, "unresolved": ["unknown"]}
Complete: a loop over paragraphs and an image
admin
if (equal (file exist "tmp/tuto_office") "0") {file mkdir "tmp/tuto_office";}; image from_base64 "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAECAIAAAA8r+mnAAAAEUlEQVR42mNQSDiAFTFQTwIAvM0oAdPssEsAAAAASUVORK5CYII=" "tmp/tuto_office/logo.png"; docx create "tmp/tuto_office/t.docx" "[{\"type\": \"paragraph\", \"text\": \"{{%logo}}\"}, {\"type\": \"paragraph\", \"text\": \"{{#people}}\"}, {\"type\": \"paragraph\", \"text\": \"{{name}}: {{#tags}}[{{.}}]{{/tags}}\"}, {\"type\": \"paragraph\", \"text\": \"{{/people}}\"}]"; docx fill "tmp/tuto_office/t.docx" "tmp/tuto_office/o.docx" "{\"logo\": {\"path\": \"tmp/tuto_office/logo.png\", \"width\": 80}, \"people\": [{\"name\": \"Ann\", \"tags\": [\"x\", \"y\"]}, {\"name\": \"Bob\", \"tags\": []}]}"; -> "[res]" (docx to_text "tmp/tuto_office/o.docx"); file delete "tmp/tuto_office"; [res]
mentdb
Ann: [x][y] Bob:

docx fill <template> <out_path> <json_data> <json_params>


Description

    Fill with parameters: strict (false; true: an unknown placeholder, section or invalid placeholder is an error and nothing is written), missing (the text of an unknown value, empty by default), max_rows (10000, the largest number of passes of a loop, up to 100000)

Parameters

    template:   The .docx template - String - required
    out_path:   The .docx file to write (the folders are created) - String - required
    json_data:   The values: a JSON object - String - required
    json_params:   The parameters - String - required
admin
if (equal (file exist "tmp/tuto_office") "0") {file mkdir "tmp/tuto_office";}; docx create "tmp/tuto_office/t.docx" "[{\"type\": \"paragraph\", \"text\": \"Name: {{name}}, phone: {{phone}}\"}]"; docx fill "tmp/tuto_office/t.docx" "tmp/tuto_office/o.docx" "{\"name\": \"Ann\"}" "{\"missing\": \"n/a\"}"; -> "[res]" (docx to_text "tmp/tuto_office/o.docx"); file delete "tmp/tuto_office"; [res]
mentdb
Name: Ann, phone: n/a
Complete: all the values must be known
admin
if (equal (file exist "tmp/tuto_office") "0") {file mkdir "tmp/tuto_office";}; docx create "tmp/tuto_office/t.docx" "[{\"type\": \"paragraph\", \"text\": \"{{name}} {{city}}\"}]"; -> "[res]" (docx fill "tmp/tuto_office/t.docx" "tmp/tuto_office/o.docx" "{\"name\": \"Ann\", \"city\": \"Paris\"}" "{\"strict\": true}"); file delete "tmp/tuto_office"; [res]
mentdb
{"out_path": "tmp/tuto_office/o.docx", "replaced": 2, "unresolved": []}
Used in use cases (1 recipe)

    Integrator & ETL developer › Generate a Word document from a template: fields, a repeated table row, a condition
Often used with

    docx create  ·  docx placeholders  ·  docx to_text  ·  equal  ·  file delete  ·  file exist  ·  file mkdir  ·  string char

docx placeholders <template>


Description

    The placeholders of a template, even split by Word across runs, in the order of the document: name, type (value, loop, if, unless, image, or invalid for {{a b}}), count. Closing markers are not listed

Parameters

    template:   The .docx template - String - required
admin
if (equal (file exist "tmp/tuto_office") "0") {file mkdir "tmp/tuto_office";}; docx create "tmp/tuto_office/tpl.docx" "[{\"type\": \"heading\", \"level\": 1, \"text\": \"Invoice {{number}}\"}, {\"type\": \"paragraph\", \"text\": \"Customer: {{customer.name}}, {{customer.city}}\"}, {\"type\": \"table\", \"header\": [\"Item\", \"Qty\", \"Price\"], \"rows\": [[\"{{#lines}}{{item}}\", \"{{qty}}\", \"{{price}}{{/lines}}\"], [\"Total\", \"\", \"{{total}}\"]]}, {\"type\": \"paragraph\", \"text\": \"{{?paid}}Paid, thank you.{{/paid}}{{^paid}}Payment due within 30 days.{{/paid}}\"}]"; -> "[res]" (docx placeholders "tmp/tuto_office/tpl.docx"); file delete "tmp/tuto_office"; [res]
mentdb
[{"name": "number", "type": "value", "count": 1}, {"name": "customer.name", "type": "value", "count": 1}, {"name": "customer.city", "type": "value", "count": 1}, {"name": "lines", "type": "loop", "count": 1}, {"name": "item", "type": "value", "count": 1}, {"name": "qty", "type": "value", "count": 1}, {"name": "price", "type": "value", "count": 1}, {"name": "total", "type": "value", "count": 1}, {"name": "paid", "type": "if", "count": 1}, {"name": "paid", "type": "unless", "count": 1}]
Used in use cases (1 recipe)

    Integrator & ETL developer › Generate a Word document from a template: fields, a repeated table row, a condition
Often used with

    docx create  ·  docx fill  ·  docx to_text  ·  equal  ·  file delete  ·  file exist  ·  file mkdir  ·  string char

docx to_text <path>


Description

    The plain text of a document: one line per paragraph, list items with - or their number and an indentation, one line per table row with tabs between the cells, the text of the text boxes after their paragraph. Empty paragraphs are skipped, images ignored, tracked deletions ignored

Parameters

    path:   The .docx file - String - required
admin
if (equal (file exist "tmp/tuto_office") "0") {file mkdir "tmp/tuto_office";}; docx create "tmp/tuto_office/report.docx" "[{\"type\": \"heading\", \"level\": 1, \"text\": \"Report\"}, {\"type\": \"paragraph\", \"runs\": [{\"text\": \"Sales are \"}, {\"text\": \"up\", \"bold\": true}, {\"text\": \" and \"}, {\"text\": \"stable\", \"italic\": true}, {\"text\": \", see \"}, {\"text\": \"the site\", \"link\": \"https://www.mentdb.org\"}]}, {\"type\": \"heading\", \"level\": 2, \"text\": \"Actions\"}, {\"type\": \"bullet_list\", \"items\": [\"Call\", {\"text\": \"the bank\", \"level\": 1}, \"Pay\"]}, {\"type\": \"numbered_list\", \"items\": [\"First\", \"Second\"]}, {\"type\": \"table\", \"header\": [\"Shop\", \"Amount\"], \"rows\": [[\"A\", 100], [\"B\", 250.5]], \"widths\": [60, 40]}]" "{\"title\": \"Monthly report\", \"author\": \"MentDB\", \"created\": \"2026-11-04T08:00:00Z\"}"; -> "[res]" (docx to_text "tmp/tuto_office/report.docx"); file delete "tmp/tuto_office"; [res]
mentdb
Report Sales are up and stable, see the site Actions - Call - the bank - Pay 1. First 2. Second Shop Amount A 100 B 250.5

docx to_text <path> <json_params>


Description

    Plain text with parameters: cell_separator (a tab), list_markers (true), headers (false; true adds the text of the headers before and of the footers after)

Parameters

    path:   The .docx file - String - required
    json_params:   The parameters - String - required
admin
if (equal (file exist "tmp/tuto_office") "0") {file mkdir "tmp/tuto_office";}; docx create "tmp/tuto_office/report.docx" "[{\"type\": \"heading\", \"level\": 1, \"text\": \"Report\"}, {\"type\": \"paragraph\", \"runs\": [{\"text\": \"Sales are \"}, {\"text\": \"up\", \"bold\": true}, {\"text\": \" and \"}, {\"text\": \"stable\", \"italic\": true}, {\"text\": \", see \"}, {\"text\": \"the site\", \"link\": \"https://www.mentdb.org\"}]}, {\"type\": \"heading\", \"level\": 2, \"text\": \"Actions\"}, {\"type\": \"bullet_list\", \"items\": [\"Call\", {\"text\": \"the bank\", \"level\": 1}, \"Pay\"]}, {\"type\": \"numbered_list\", \"items\": [\"First\", \"Second\"]}, {\"type\": \"table\", \"header\": [\"Shop\", \"Amount\"], \"rows\": [[\"A\", 100], [\"B\", 250.5]], \"widths\": [60, 40]}]" "{\"title\": \"Monthly report\", \"author\": \"MentDB\", \"created\": \"2026-11-04T08:00:00Z\"}"; -> "[res]" (docx to_text "tmp/tuto_office/report.docx" "{\"cell_separator\": \";\", \"list_markers\": false}"); file delete "tmp/tuto_office"; [res]
mentdb
Report Sales are up and stable, see the site Actions Call the bank Pay First Second Shop;Amount A;100 B;250.5
Used in use cases (1 recipe)

    Integrator & ETL developer › Generate a Word document from a template: fields, a repeated table row, a condition
Often used with

    docx create  ·  docx fill  ·  docx placeholders  ·  equal  ·  file delete  ·  file exist  ·  file mkdir  ·  string char

docx to_markdown <path>


Description

    The document as Markdown: headings (styles Heading 1 to 6, Title, Subtitle, outline level), bold, italic, bullet and numbered lists with their levels, tables (the first row as header), links (only http, https, mailto, ftp, tel and internal anchors; other links keep their text). Images and tracked deletions are ignored, and a table inside a cell gives only its text

Parameters

    path:   The .docx file - String - required
admin
if (equal (file exist "tmp/tuto_office") "0") {file mkdir "tmp/tuto_office";}; docx create "tmp/tuto_office/report.docx" "[{\"type\": \"heading\", \"level\": 1, \"text\": \"Report\"}, {\"type\": \"paragraph\", \"runs\": [{\"text\": \"Sales are \"}, {\"text\": \"up\", \"bold\": true}, {\"text\": \" and \"}, {\"text\": \"stable\", \"italic\": true}, {\"text\": \", see \"}, {\"text\": \"the site\", \"link\": \"https://www.mentdb.org\"}]}, {\"type\": \"heading\", \"level\": 2, \"text\": \"Actions\"}, {\"type\": \"bullet_list\", \"items\": [\"Call\", {\"text\": \"the bank\", \"level\": 1}, \"Pay\"]}, {\"type\": \"numbered_list\", \"items\": [\"First\", \"Second\"]}, {\"type\": \"table\", \"header\": [\"Shop\", \"Amount\"], \"rows\": [[\"A\", 100], [\"B\", 250.5]], \"widths\": [60, 40]}]" "{\"title\": \"Monthly report\", \"author\": \"MentDB\", \"created\": \"2026-11-04T08:00:00Z\"}"; -> "[res]" (docx to_markdown "tmp/tuto_office/report.docx"); file delete "tmp/tuto_office"; [res]
mentdb
# Report Sales are **up** and *stable*, see [the site](https://www.mentdb.org) ## Actions - Call - the bank - Pay 1. First 2. Second | Shop | Amount | | --- | --- | | A | 100 | | B | 250.5 |

docx tables <path>


Description

    The tables of the body as a JSON array of tables, each one an array of rows, each one an array of cell texts (a merged cell gives empty cells so that the columns stay aligned; a table inside a cell only gives its text)

Parameters

    path:   The .docx file - String - required
admin
if (equal (file exist "tmp/tuto_office") "0") {file mkdir "tmp/tuto_office";}; docx create "tmp/tuto_office/report.docx" "[{\"type\": \"heading\", \"level\": 1, \"text\": \"Report\"}, {\"type\": \"paragraph\", \"runs\": [{\"text\": \"Sales are \"}, {\"text\": \"up\", \"bold\": true}, {\"text\": \" and \"}, {\"text\": \"stable\", \"italic\": true}, {\"text\": \", see \"}, {\"text\": \"the site\", \"link\": \"https://www.mentdb.org\"}]}, {\"type\": \"heading\", \"level\": 2, \"text\": \"Actions\"}, {\"type\": \"bullet_list\", \"items\": [\"Call\", {\"text\": \"the bank\", \"level\": 1}, \"Pay\"]}, {\"type\": \"numbered_list\", \"items\": [\"First\", \"Second\"]}, {\"type\": \"table\", \"header\": [\"Shop\", \"Amount\"], \"rows\": [[\"A\", 100], [\"B\", 250.5]], \"widths\": [60, 40]}]" "{\"title\": \"Monthly report\", \"author\": \"MentDB\", \"created\": \"2026-11-04T08:00:00Z\"}"; -> "[res]" (docx tables "tmp/tuto_office/report.docx"); file delete "tmp/tuto_office"; [res]
mentdb
[[["Shop", "Amount"], ["A", "100"], ["B", "250.5"]]]

docx tables <path> <json_params>


Description

    Tables with parameters: header (false; true: the first row gives the names and each table is an array of objects, which fits the functions on rows). Empty names become col_1, col_2..., repeated names get _2

Parameters

    path:   The .docx file - String - required
    json_params:   The parameters - String - required
admin
if (equal (file exist "tmp/tuto_office") "0") {file mkdir "tmp/tuto_office";}; docx create "tmp/tuto_office/report.docx" "[{\"type\": \"heading\", \"level\": 1, \"text\": \"Report\"}, {\"type\": \"paragraph\", \"runs\": [{\"text\": \"Sales are \"}, {\"text\": \"up\", \"bold\": true}, {\"text\": \" and \"}, {\"text\": \"stable\", \"italic\": true}, {\"text\": \", see \"}, {\"text\": \"the site\", \"link\": \"https://www.mentdb.org\"}]}, {\"type\": \"heading\", \"level\": 2, \"text\": \"Actions\"}, {\"type\": \"bullet_list\", \"items\": [\"Call\", {\"text\": \"the bank\", \"level\": 1}, \"Pay\"]}, {\"type\": \"numbered_list\", \"items\": [\"First\", \"Second\"]}, {\"type\": \"table\", \"header\": [\"Shop\", \"Amount\"], \"rows\": [[\"A\", 100], [\"B\", 250.5]], \"widths\": [60, 40]}]" "{\"title\": \"Monthly report\", \"author\": \"MentDB\", \"created\": \"2026-11-04T08:00:00Z\"}"; -> "[res]" (docx tables "tmp/tuto_office/report.docx" "{\"header\": true}"); file delete "tmp/tuto_office"; [res]
mentdb
[[{"Shop": "A", "Amount": "100"}, {"Shop": "B", "Amount": "250.5"}]]

docx info <path>


Description

    The figures of a document: paragraphs (with those of the tables and text boxes), tables, images, words, sections, and its properties title, subject, author, created and modified (ISO dates in UTC, null when absent)

Parameters

    path:   The .docx file - String - required
admin
if (equal (file exist "tmp/tuto_office") "0") {file mkdir "tmp/tuto_office";}; docx create "tmp/tuto_office/report.docx" "[{\"type\": \"heading\", \"level\": 1, \"text\": \"Report\"}, {\"type\": \"paragraph\", \"runs\": [{\"text\": \"Sales are \"}, {\"text\": \"up\", \"bold\": true}, {\"text\": \" and \"}, {\"text\": \"stable\", \"italic\": true}, {\"text\": \", see \"}, {\"text\": \"the site\", \"link\": \"https://www.mentdb.org\"}]}, {\"type\": \"heading\", \"level\": 2, \"text\": \"Actions\"}, {\"type\": \"bullet_list\", \"items\": [\"Call\", {\"text\": \"the bank\", \"level\": 1}, \"Pay\"]}, {\"type\": \"numbered_list\", \"items\": [\"First\", \"Second\"]}, {\"type\": \"table\", \"header\": [\"Shop\", \"Amount\"], \"rows\": [[\"A\", 100], [\"B\", 250.5]], \"widths\": [60, 40]}]" "{\"title\": \"Monthly report\", \"author\": \"MentDB\", \"created\": \"2026-11-04T08:00:00Z\"}"; -> "[res]" (docx info "tmp/tuto_office/report.docx"); file delete "tmp/tuto_office"; [res]
mentdb
{"paragraphs": 15, "tables": 1, "images": 0, "words": 22, "sections": 1, "title": "Monthly report", "subject": null, "author": "MentDB", "created": "2026-11-04T08:00:00Z", "modified": null}
Used in use cases (1 recipe)

    Integrator & ETL developer › One Markdown report published in HTML, in Word and in plain text
Often used with

    equal  ·  file delete  ·  file exist  ·  file mkdir  ·  markdown to_docx  ·  markdown to_html  ·  markdown to_text  ·  string char

docx create <out_path> <json_blocks>


Description

    Create a document from blocks: {"type": "heading", "level": 1 to 6, "text" or "runs"}, {"type": "paragraph", "text" or "runs", "align": left, center, right or justify, "indent": mm}, {"type": "bullet_list" or "numbered_list", "items": [text or {"text" or "runs", "level": 0 to 8, "numbered": true or false}]}, {"type": "table", "header": [...], "rows": [[...]], "widths": [mm]}: a cell is a value, a run or a list of runs, {"type": "image", "path", "width", "height", "align"} in pixels (reduced to the width of the page when no size is given), {"type": "page_break"}, {"type": "rule"}. A run: {"text", "bold", "italic", "underline", "color": "#RRGGBB", "size": points, "font", "link"}, http, https, mailto, ftp or tel links only. A line break in a text gives a line break. Returns {out_path, blocks}

Parameters

    out_path:   The .docx file to write (the folders are created) - String - required
    json_blocks:   The blocks: a JSON array - String - required
admin
if (equal (file exist "tmp/tuto_office") "0") {file mkdir "tmp/tuto_office";}; docx create "tmp/tuto_office/report.docx" "[{\"type\": \"heading\", \"level\": 1, \"text\": \"Report\"}, {\"type\": \"paragraph\", \"runs\": [{\"text\": \"Sales are \"}, {\"text\": \"up\", \"bold\": true}, {\"text\": \" and \"}, {\"text\": \"stable\", \"italic\": true}, {\"text\": \", see \"}, {\"text\": \"the site\", \"link\": \"https://www.mentdb.org\"}]}, {\"type\": \"heading\", \"level\": 2, \"text\": \"Actions\"}, {\"type\": \"bullet_list\", \"items\": [\"Call\", {\"text\": \"the bank\", \"level\": 1}, \"Pay\"]}, {\"type\": \"numbered_list\", \"items\": [\"First\", \"Second\"]}, {\"type\": \"table\", \"header\": [\"Shop\", \"Amount\"], \"rows\": [[\"A\", 100], [\"B\", 250.5]], \"widths\": [60, 40]}]"; -> "[res]" (docx to_text "tmp/tuto_office/report.docx"); file delete "tmp/tuto_office"; [res]
mentdb
Report Sales are up and stable, see the site Actions - Call - the bank - Pay 1. First 2. Second Shop Amount A 100 B 250.5
Complete: an image and a page break
admin
if (equal (file exist "tmp/tuto_office") "0") {file mkdir "tmp/tuto_office";}; image from_base64 "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAECAIAAAA8r+mnAAAAEUlEQVR42mNQSDiAFTFQTwIAvM0oAdPssEsAAAAASUVORK5CYII=" "tmp/tuto_office/logo.png"; -> "[res]" (docx create "tmp/tuto_office/i.docx" "[{\"type\": \"image\", \"path\": \"tmp/tuto_office/logo.png\", \"width\": 160, \"align\": \"center\"}, {\"type\": \"page_break\"}, {\"type\": \"paragraph\", \"text\": \"Page 2\"}]"); file delete "tmp/tuto_office"; [res]
mentdb
{"out_path": "tmp/tuto_office/i.docx", "blocks": 3}

docx create <out_path> <json_blocks> <json_params>


Description

    Create with parameters: page_size (A4, A3, A5, Letter, Legal), orientation (portrait, landscape), margins (mm: a number, or an object with top, bottom, left, right; 25), font (Calibri), size (points, 11), title, subject, author, created (a date like 2026-11-04T08:00:00Z)

Parameters

    out_path:   The .docx file to write (the folders are created) - String - required
    json_blocks:   The blocks: a JSON array - String - required
    json_params:   The parameters - String - required
admin
if (equal (file exist "tmp/tuto_office") "0") {file mkdir "tmp/tuto_office";}; docx create "tmp/tuto_office/c.docx" "[{\"type\": \"paragraph\", \"text\": \"One short line\"}]" "{\"page_size\": \"Letter\", \"orientation\": \"landscape\", \"margins\": 15, \"font\": \"Arial\", \"size\": 12, \"title\": \"Note\", \"author\": \"MentDB\", \"created\": \"2026-11-04T08:00:00Z\"}"; -> "[res]" (docx info "tmp/tuto_office/c.docx"); file delete "tmp/tuto_office"; [res]
mentdb
{"paragraphs": 1, "tables": 0, "images": 0, "words": 3, "sections": 1, "title": "Note", "subject": null, "author": "MentDB", "created": "2026-11-04T08:00:00Z", "modified": null}
Used in use cases (1 recipe)

    Integrator & ETL developer › Generate a Word document from a template: fields, a repeated table row, a condition
Often used with

    docx fill  ·  docx placeholders  ·  docx to_text  ·  equal  ·  file delete  ·  file exist  ·  file mkdir  ·  string char

markdown to_html <text>


Description

    Markdown (CommonMark and GFM tables) to HTML, safely: raw HTML is escaped, only http, https, mailto, ftp, tel and relative links are kept (javascript: and data: give an empty address, images also accept data:image in png, jpeg, gif and webp), links get rel="nofollow"

Parameters

    text:   The Markdown text - String - required
admin
markdown to_html "# Report Sales are **up** and *stable*, see [the site](https://www.mentdb.org). - Call - Pay | Shop | Amount | |---|---| | A | 100 | | B | 250.5 | "
mentdb
<h1>Report</h1> <p>Sales are <strong>up</strong> and <em>stable</em>, see <a rel="nofollow" href="https://www.mentdb.org">the site</a>.</p> <ul> <li>Call</li> <li>Pay</li> </ul> <table> <thead> <tr> <th>Shop</th> <th>Amount</th> </tr> </thead> <tbody> <tr> <td>A</td> <td>100</td> </tr> <tr> <td>B</td> <td>250.5</td> </tr> </tbody> </table>
raw HTML and a javascript link are neutralized
admin
markdown to_html "Hi <script>alert(1)</script> [click](javascript:alert(1))"
mentdb
<p>Hi <script>alert(1)</script> <a rel="nofollow" href="">click</a></p>

markdown to_html <text> <json_params>


Description

    To HTML with parameters: safe (true; false keeps the raw HTML and all the links, only for trusted text), tables (true), full_page (false; true gives a whole HTML page), title (of the full page)

Parameters

    text:   The Markdown text - String - required
    json_params:   The parameters - String - required
admin
markdown to_html "# Hello" "{\"full_page\": true, \"title\": \"My page\"}"
mentdb
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>My page</title> </head> <body> <h1>Hello</h1> </body> </html>
trusted text
admin
markdown to_html "A <b>bold</b> word" "{\"safe\": false}"
mentdb
<p>A <b>bold</b> word</p>
Used in use cases (1 recipe)

    Integrator & ETL developer › One Markdown report published in HTML, in Word and in plain text
Often used with

    docx info  ·  equal  ·  file delete  ·  file exist  ·  file mkdir  ·  markdown to_docx  ·  markdown to_text  ·  string char

markdown to_text <text>


Description

    Markdown to plain text: the marks are removed, list items keep - or their number, table cells are separated by tabs, a link gives its text, an image its alternative text, raw HTML its text

Parameters

    text:   The Markdown text - String - required
admin
markdown to_text "# Report Sales are **up** and *stable*, see [the site](https://www.mentdb.org). - Call - Pay | Shop | Amount | |---|---| | A | 100 | | B | 250.5 | "
mentdb
Report Sales are up and stable, see the site. - Call - Pay Shop Amount A 100 B 250.5
Used in use cases (1 recipe)

    Integrator & ETL developer › One Markdown report published in HTML, in Word and in plain text
Often used with

    docx info  ·  equal  ·  file delete  ·  file exist  ·  file mkdir  ·  markdown to_docx  ·  markdown to_html  ·  string char

markdown to_docx <text> <out_path>


Description

    Markdown to Word through docx create: headings, bold, italic, code in Consolas, links, lists, tables, quotes (indented), horizontal rules. Raw HTML stays as text, an image gives its alternative text. Returns {out_path, blocks}

Parameters

    text:   The Markdown text - String - required
    out_path:   The .docx file to write (the folders are created) - String - required
admin
if (equal (file exist "tmp/tuto_office") "0") {file mkdir "tmp/tuto_office";}; markdown to_docx "# Report Sales are **up** and *stable*, see [the site](https://www.mentdb.org). - Call - Pay | Shop | Amount | |---|---| | A | 100 | | B | 250.5 | " "tmp/tuto_office/m.docx"; -> "[res]" (docx to_markdown "tmp/tuto_office/m.docx"); file delete "tmp/tuto_office"; [res]
mentdb
# Report Sales are **up** and *stable*, see [the site](https://www.mentdb.org). - Call - Pay | Shop | Amount | | --- | --- | | A | 100 | | B | 250.5 |

markdown to_docx <text> <out_path> <json_params>


Description

    To Word with the parameters of docx create, and images (false; true: an image alone in its paragraph with a local path is inserted; the path follows the rights of file load, a remote address is never read)

Parameters

    text:   The Markdown text - String - required
    out_path:   The .docx file to write (the folders are created) - String - required
    json_params:   The parameters - String - required
admin
if (equal (file exist "tmp/tuto_office") "0") {file mkdir "tmp/tuto_office";}; image from_base64 "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAECAIAAAA8r+mnAAAAEUlEQVR42mNQSDiAFTFQTwIAvM0oAdPssEsAAAAASUVORK5CYII=" "tmp/tuto_office/logo.png"; markdown to_docx "# Logo ![logo](tmp/tuto_office/logo.png) " "tmp/tuto_office/m.docx" "{\"images\": true, \"title\": \"With a logo\", \"created\": \"2026-11-04T08:00:00Z\"}"; -> "[res]" (docx info "tmp/tuto_office/m.docx"); file delete "tmp/tuto_office"; [res]
mentdb
{"paragraphs": 2, "tables": 0, "images": 1, "words": 1, "sections": 1, "title": "With a logo", "subject": null, "author": "MentDB", "created": "2026-11-04T08:00:00Z", "modified": null}
Used in use cases (1 recipe)

    Integrator & ETL developer › One Markdown report published in HTML, in Word and in plain text
Often used with

    docx info  ·  equal  ·  file delete  ·  file exist  ·  file mkdir  ·  markdown to_html  ·  markdown to_text  ·  string char

markdown from_html <html>


Description

    HTML to Markdown with jsoup: headings, paragraphs, bold, italic, code, code blocks, nested lists, tables (the first row, or the thead, as header), quotes, links, images, horizontal rules. Scripts, styles, frames and form controls are removed, javascript: links keep their text only

Parameters

    html:   The HTML text - String - required
admin
markdown from_html "<h1>Title</h1><script>alert(1)</script><p>Some <b>bold</b> and <a href=\"https://www.mentdb.org\">a link</a></p><ul><li>one</li><li>two<ul><li>nested</li></ul></li></ul><table><tr><th>A</th><th>B</th></tr><tr><td>1</td><td>2</td></tr></table>"
mentdb
# Title Some **bold** and [a link](https://www.mentdb.org) - one - two - nested | A | B | | --- | --- | | 1 | 2 |