Colour markdown's tables and the addresses written in it
A table is recognised by its delimiter row, the only line of one that cannot be anything else, and its header is the line above -- the single place the scanner looks ahead. Colouring every `|` instead would have marked the pipes of a shell command written in a paragraph. Addresses come in two shapes: `<...>` needs a scheme's colon or an at sign inside it and no whitespace, which leaves `<div>` alone; a bare `scheme://` needs no closer, so where it ends is the decision -- the sentence's trailing punctuation is given back, and so is a closing bracket unless one opened inside the URL. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
68c5180260
commit
7997eeb7f8
4 files changed
+238
-8
No files matched your search
@@ -253,7 +253,10 @@ and are the reason several tempting simplifications were rejected.
|
||||
not start or end inside a word (`snake_case_name`), and an indented code
|
||||
block is left plain, because four spaces after a blank line and four
|
||||
spaces after a bullet are the same line and only what came before tells
|
||||
them apart.
|
||||
them apart. A table is the one thing it looks ahead for: the delimiter row
|
||||
(`|---|---|`) is the only line of one that cannot be anything else, and the
|
||||
header belongs to the line before it -- which is what keeps the pipes of a
|
||||
shell command written in a paragraph plain.
|
||||
It replaced dev.snipme:highlights 1.1.0 on 2026-09-03, which found
|
||||
comments before it knew the language and paired `/*` with `*/` by
|
||||
ordinal. That library used one set of delimiters for every language, so
|
||||
|
||||
Reference in new issue
Block a user