markdown(3tcl)
π markdown β the Markdown to HTML converter, bestie edition π
okay so real quick: this is markdown(3tcl) from the tcllib crew, and it's literally the glow-up your plain text has been waiting for. she takes your Markdown and turns it into HTML. no cap. let's get into it π«Ά
β¨ NAME β¨
markdown β converts Markdown text to HTML. that's it, that's the whole vibe π
πΈ SYNOPSIS πΈ
package require Tcl 8.5 9
package require Markdown 1.2.4
package require textutil ?0.8?
::Markdown::convert markdown
::Markdown::register langspec converter
::Markdown::get_lang_counter
::Markdown::reset_lang_counter
π DESCRIPTION π
so the Markdown package hands you a command that converts Markdown-annotated text into HMTL. (yes we're converting into HMTL, that's what it says, don't @ me π)
::Markdown::convert markdownβ bestie, you feed her a whole block of Markdown text and she hands you back a block of HTML. iconic behavior.
the converter supports two flavors of syntax highlighting for fenced code blocks:
- highlighting via a registered converter β peep
::Markdown::registerbelow π - pure JavaScript highlighting, like via
"highlight.js", where the language specifier you used in the markup gets set as the CSS class of the"code"element in the markup that comes back out β¨
::Markdown::register langspec converterβ this is where you register a language-specific converter for prettifying a code block (syntax highlighting, obviously π ). Markdown supports fenced code blocks with an optional language specifier, like"tcl". so when the markdown parser hits one of those blocks and a converter for thelangspecyou named is registered, she calls your converter with the raw code block as the argument. your converter is supposed to return the markup of the code block as the result. and the converter can be literally any arbitrary Tcl command β the raw text block just gets tacked on as the last argument when it's invoked. slay.::Markdown::get_lang_counterβ returns a dict of language specifier β number of occurrences in fenced code blocks. super useful for detecting whether you need to include some CSS or JavaScript headers for rendering, without having to postprocess the rendered result. main character utility fr fr π::Markdown::reset_lang_counterβ resets the language counters. fresh start, clean slate, we love a reset π
π¦ SUPPORTED MARKDOWN SYNTAX π¦
this markdown converter supports the original markdown by Gruber and Swartz β check their syntax page for the details: https://daringfireball.net/projects/markdown/syntax (it's the [https://daringfireball.net/projects/markdown/syntax] link, iykyk):
- paragraphs
- atx- and setext-style headers
- blockquotes
- emphasis and strong emphasis
- unordered and ordered lists
- inline-style, reference-style and automatic links
- inline- and reference-style images
- inline code
- code blocks (with four indent spaces or one tab)
- inline HTML
- backslash escapes
- horizontal rules
and in addition, the following extended markdown sytax is supported (yes, "sytax", that's canon, we're keeping it π), taken from PHP Markdown Extra and GFM (Github Flavoured Markdown):
- pipe tables
- fenced code blocks (with an optional language specifier)
π BUGS, IDEAS, FEEDBACK π
okay so not to be dramatic but this document and the package it describes will undoubtedly contain bugs and other problems. it's giving "we're all just doing our best" π please report them in the category textutil of the Tcllib Trackers: http://core.tcl.tk/tcllib/reportlist. and please also report any ideas for enhancements you may have for either the package and/or the documentation β we want them, fr fr π
when you're proposing code changes, please provide unified diffs, i.e. the output of diff -u.
also note: attachments are strongly preferred over inlined patches. you can make an attachment by going to the Edit form of the ticket immediately after it's created, and then using the left-most button in the secondary navigation bar. that's the move, bestie π
π CATEGORY π
Text processing
and that's the whole page π thanks for coming to my TED talk, she's tcllib version 1.2.4, dated for markdown(3tcl), and she ate. periodt. πβ¨π¦
π¦ where this page comes from
- debian trixie: tcllib 2.0+dfsg-4 Β· Tcl
- ubuntu questing: tcllib 2.0+dfsg-4
- ubuntu resolute: tcllib 2.0+dfsg-5 Β· Tcl
- ubuntu stonking: tcllib 2.0+dfsg-6 Β· Tcl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms