markdown(3tcl)

πŸ“¦
version 2.0 Β· 3 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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:

  1. highlighting via a registered converter β€” peep ::Markdown::register below πŸ‘€
  2. 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 the langspec you 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