Repository navigation
Releases
v0.3.0
Added
-
GitHub-style alerts: a top-level block quote that starts with
[!NOTE],[!TIP],[!IMPORTANT],[!WARNING], or[!CAUTION]alone on its line (any letter case), followed by text, is ablockquote.limmat-alert.limmat-alert-note(and so on) with ap.limmat-alert-titlefirst. While the marker is arriving, or before any text follows it, nothing of it shows, and a marker that never gets text stays plain text, as on GitHub. The titles are the newlabels.note,tip,important,warning, andcaution, and the optionalstyle.csscolors each type. -
HTML entities: numeric references (
#,#) and the names&,<,>,",', and now show as their character, in text and in a link destination (checked after decoding, sojavascript:is still refused). The result is always plain text, so<b>never becomes a tag and*never becomes emphasis. Code, autolinks, and bare URLs keep the text as written. Other names, like©, still show literally. While one is arriving (&,&am,) it is held back. -
Underlined headings: a paragraph over a line of
=is anh1, and over a line of-is anh2, as in CommonMark. The heading holds every line of the paragraph, the underline may be indented up to three spaces, and a lazy line in a quote or list item is never an underline. While the underline is still arriving it is held back, so no=or-shows. A line of---right under a paragraph used to be a rule and is now an underline, soTextover---is a heading, not text and a rule. -
Indented code blocks: a line indented four spaces or more, after a blank line, at the start, or after a heading, rule, fence, or table, is a code block with the Copy button, as in CommonMark. Blank lines inside it are kept and the ones around it are dropped. The text is shown as written (no markup, no entities), and the indent is removed from each line. It works in a quote and in a list item (four columns past the item text). An indented line still continues a paragraph, and 4-space nesting in lists is unchanged. A tab counts to the next multiple of four columns when it decides whether a line is indented, so
\tcodeis a code block. Tabs are not expanded after a list marker or in a nested item, and tabs inside code are never changed. This changes output: text that was a paragraph or a list after a blank line and indented four spaces (for example- aright after a paragraph and a blank line) is now code, as on GitHub. A table row indented four spaces ends the table. -
limmat/server:renderToString(markdown, options)returns the HTML of a whole text, with no DOM and no globals, so a server can render a reply. It runs the same parser and builder aswritefollowed byend()(a small in-memory DOM stands in for the page), so the string is exactly what the DOM path serializes to for every test document. Text and attribute values are escaped, andhighlight,onLinkClick, andthrottleMsare left out because they need a page. It is a separate entry, so the core size does not change. -
limmat creates its elements with
container.ownerDocumentinstead of the globaldocument, so it renders into an element of jsdom, linkedom, or happy-dom with no globals set. All three are tested, andend()leaves the final output in place with no timer pending, soinnerHTMLcan be read right after it. -
Task list checkboxes and
<details>toggles are written as attributes (type,disabled,checked,open) instead of properties. A browser reads them as the same state, and linkedom serializes them.
Fixed
- A lazy line in a list item that is indented four spaces or more and looks like a block (
- x,# x,---,>) now continues the item's paragraph, as in CommonMark. It used to turn into a nested block. - A lazy line after a table that sits two containers deep (
> > | a |over> > |---|, or> - | a |over> |---|) now ends the outer quote or item too, as in GFM. It used to stay in the outer container. - A line such as
- |---|---|under a pipe line is a list item, not a table delimiter row, as in GFM. The line above stays a paragraph. It used to become a table with an empty first header cell.
v0.2.0
Added
- An image that is not shown (
images: false, an origin that is not in your list, or a refused URL) now rendersImage not shown: alt textin alimmat-image-blockedspan, so a reader can tell that an image was removed. It used to leave the bare alt text. The words are the newlabels.imageNotShown. An image inside a link label still shows only its alt text. - An
<img>gets the classlimmat-image-loadedwhen it has loaded andlimmat-image-failedwhen it fails. The optionalstyle.cssuses them: an image holds a placeholder box until it loads, so the text below does not jump, and a failed image shows its alt text in a soft pill.
Changed
[call](tel:+31201234567),irc:,ircs:, andxmpp:links are now links by default, the same list as Streamdown. To keep the old default, passallowedProtocols: ['https', 'http', 'mailto'].
Fixed
- A
classPrefixwith a space, quote, dot, or bracket, or an empty one, no longer breaks the Copy button or gives classes such as-link. A prefix that is not a plain class name useslimmat. - An empty or blank entry in
labelskeeps its default, so the Copy button and the table always have a name. The Copy button's name used to bejs. allowedProtocolsthat is not an array uses the default list. It used to throw aTypeErrorfromcreateRenderer.- The language label in a code header drops bidi, control, and zero-width characters. A right-to-left override in the language could reorder the text next to it.
- A line without the item's indent or the quote's
>(a lazy line) stays text in the item or quote, as in GFM. A pipe line right after- itemor> quoteused to end it and start a table or paragraph below. A lazy line after a table inside an item or quote used to become a table row, and now ends the item or quote. A table inside an item or quote that is nested two containers deep (> - | a |over> |---|) still lets a lazy line after it stay in the outer quote. - A table whose header has no outer pipes now splits off from the paragraph above it (
Here:thena | bover--|--), as in GFM. It used to stay one paragraph. - A line that starts with a pipe stays in the paragraph above it unless it starts a table (the next line is a delimiter row with as many cells), as in GFM. Pipe lines that are not a table used to become one paragraph each. While a pipe line is the last line and might still start a table, it is not shown until the next line arrives.
- A line continues a list item only if it is indented to the item's content column, as in CommonMark (3 spaces under
1., 4 under10., 2 under-). Two spaces under1.used to nest a list, a quote, or a paragraph inside the item. - A link title that contains an escaped quote (
[a](/u "say \"hi\"")) is a link again. The whole link used to turn into text. - A
highlightfunction that callswriteno longer re-enters the renderer. Its text is added after the current update, and the block it was called for is highlighted once. - A link inside link text is now the link, and the outer brackets stay text, as in CommonMark. The outer link used to win and the inner one was flattened.
- A table whose delimiter row has a different number of cells than the header is text, as in GFM. It used to render as a table with ragged rows.
- A run of three or more tildes is text, as in GFM.
~~~x~~~inside a paragraph used to show~around struck-out text. - A different bullet (
-,+,*) or number delimiter (.,)) now starts a new list, as in CommonMark. A list that switched markers used to render as one list. - Only
1.or1)can interrupt a paragraph, as in CommonMark. A line such as42. Nobody noticed.inside a paragraph used to start a numbered list. - An
<img>in a block that is still open keeps its element while more text arrives, instead of being replaced on every update. Images no longer blink in Safari when they cannot be cached. highlightis called once, with the whole code, for a fence that contains a line starting like a closing fence (a```mdfence with a```jsline inside). Streaming it one character at a time used to close the fence at the partial```, highlight the truncated code, and reopen it. A closing fence on a line that is still arriving now waits for the end of the line (orend()) before the fence counts as closed.import 'limmat/style.css'no longer fails with TS2882 under TypeScript 7, because the stylesheet export now ships a type declaration.
v0.1.1
Changed
- The package description and keywords match the GitHub About text and topics.
- The README demo GIF is recorded at 1080p, one character per chunk, and served from the demo site.
v0.1.0
Added
- First release:
createRenderer(container, options)withwrite,end,reset, anddestroy. - Safe-by-construction rendering of headings, emphasis, strikethrough, inline code, fenced code with a language label and Copy button, blockquotes, nested bullet and numbered lists, task lists, tables with column alignment and a keyboard-scrollable wrapper, horizontal rules, links, autolinked URLs and emails, and hard line breaks.
- Link policy: protocol allow-list, site-path approval, and
onLinkClick. - HTML tags: attribute-free
b,strong,i,em,u,s,del,ins,mark,small,kbd,sub, andsupbecome elements, and thehtmloption narrows the list or turns it off. Tags with attributes and all other tags stay text. - Collapsible sections:
<details>(or<details open>), an optional<summary>line, markdown content, and</details>render nativedetailsandsummaryelements, nested up to 12 levels. A block that never closes opens when the message ends. Thehtmloption controls it with the namedetails. The reader's toggle survives while streaming. externalLinksNewTaboption (defaulttrue):falseleaveshttpandhttpslinks withouttargetandrel.- Images:
renders an<img>by default, with the link URL checks,loading="lazy", andreferrerpolicy="no-referrer". Theimagesoption takes an origin list orfalse. Images load without a click, so see "What limmat does not guarantee by default" in SECURITY.md. limmat/highlightadapter for@speed-highlight/coreand optionallimmat/style.css, which also styles a renderer inside a shadow root.createRendererempties its container, so a remount (React StrictMode) does not duplicate a finished message.- Tables are wrapped in
role="group"with a label, so many tables on a page do not repeat one landmark.
Install: npm install limmat. Full changelog: https://github.com/DaanRosendal/limmat/blob/master/CHANGELOG.md
Demo media
The demo GIFs the README shows, kept out of git history. Not a package release. Re-record with npm run record and upload with gh release upload media --clobber.