markdown(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

πŸ’– markdown(n) β€” Markdown to HTML Converter πŸ’–

okay bestie, sit DOWN because this is the markdown page from the Markdown package in tcllib, and it is literally the whole reason your Markdown text gets to glow up into HTML. no cap. ✨


🌸 NAME 🌸

markdown β€” converts Markdown text to HTML. that's it. that's the girl. πŸ’…


πŸŽ€ 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

like yes, Tcl 8.5 9 β€” those are the versions, don't come for me. and textutil ?0.8? has the lil question marks because that requirement is optional, iykyk. πŸ¦‹


✨ DESCRIPTION ✨

so the package Markdown gives you exactly one (1) command to turn Markdown-annotated text into HTML. iconic behavior honestly. πŸ‘‘

πŸ’œ ::Markdown::convert markdown

this command takes in a whole block of Markdown text and hands you back a block of HTML. it's giving magic trick. πŸͺ„

the converter supports two types of syntax highlighting for fenced code blocks, and you're gonna want to know both:

  • highlighting via a registered converter β€” see ::Markdown::register below πŸ‘‡
  • pure JavaScript highlighting, e.g. via "highlight.js" β€” in this case the language specifier used in the markup gets set as the CSS class of the "code" element in the returned markup 🌈

πŸ’œ ::Markdown::register langspec converter

register a language-specific converter for prettifying a code block (like, say, syntax highlighting, bestie). Markdown supports fenced code blocks with an optional language specifier β€” e.g. "tcl". when the markdown parser processes such a code block and there's a converter registered for the specified langspec, the converter gets called with the raw code block as its argument. the converter is supposed to return the markup of the code block as the result. πŸ“

the specified converter can be an arbitrary Tcl command, and the raw text block gets added as the last argument upon invocation. so like, it's flexible, she's versatile. πŸŽ€

πŸ’œ ::Markdown::get_lang_counter

returns a dict of language specifier and number of occurrences in fenced code blocks. use this if you wanna detect, e.g., whether some CSS or JavaScript headers should be included for rendering β€” that way you don't have to postprocess the rendered result. efficiency queen. πŸ’…

πŸ’œ ::Markdown::reset_lang_counter

resets the language counters. clean slate, new era, fresh start. 🧚


πŸ¦‹ SUPPORTED MARKDOWN SYNTAX πŸ¦‹

this converter supports the original markdown by Gruber and Swartz β€” their syntax page lives at [https://daringfireball.net/projects/markdown/syntax] if you want the details. here's the whole roster, no gatekeeping:

  • 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 THEN, as if that wasn't enough, the following extended markdown syntax is supported too, taken from PHP Markdown Extra and GFM (Github Flavoured Markdown):

  • pipe tables
  • fenced code blocks (with an optional language specifier)

she does both. main character energy fr fr. 🌟


😭 BUGS, IDEAS, FEEDBACK 😭

this document, and the package it describes, will undoubtedly contain bugs and other problems. bestie, even the icon has flaws. πŸ’€

please report such bugs 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 wanna hear it. 🫢

when proposing code changes, please provide unified diffs, i.e. the output of diff -u. no vibe-based patches, we need the receipts. πŸ™ˆ

note further that attachments are strongly preferred over inlined patches. you can make an attachment by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. yes, that button. the left-most one. 🎯


πŸ“ CATEGORY πŸ“

Text processing. (very demure, very mindful. πŸ’œ)


and that's the whole page, bestie!! this gem is from tcllib, version 1.2.4, and it's the markdown(n) page β€” go forth and convert. slay, periodt. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…

πŸ“¦ where this page comes from