Spanish Total.js
English
Documentation For AI agents
Contents

Markdown

Convert Markdown to HTML with String.prototype.markdown(), and the Markdown syntax it supports.

.md GitHub

String.prototype.markdown([options]) converts Markdown to HTML. The output is wrapped in div class="markdown markdown-container" and every block has the class markdown-line, so you can style it.

var html = '# Hello\n\nSome **bold** text with a [link](https://www.totaljs.com).'.markdown();

Besides the usual headings (# to #####), **bold**, *italic*, __bold__, _underline_, ~~strike~~, inline code, code blocks, lists (nested with tabs, tasks with [ ] and [x]), tables with alignment, > quotes, --- lines, links and images, it supports a few extensions:

SyntaxOutput
or An icon <i class="ti ti-check">
keyword<span class="markdown-keyword" data-type="type">
[1](#1) and a line #1: textA footnote and its text
< textA <section>
::: Title … :::A block that can be expanded
alt, altAn image without img-responsive, a gallery image

Headings get an id made from their text (turn it off with bookmarks: false, or add prefix). Each feature can be turned off: { tables: false, images: false, code: false } and so on. wrap: false removes the outer <div>, linetag changes the <p> of paragraphs, and html(text, type) lets you change the text of each block.

Made in Europe