commonmark-extensions
Pure Haskell commonmark parser.
https://github.com/jgm/commonmark-hs
LTS Haskell 23.27: | 0.2.6 |
Stackage Nightly 2025-07-12: | 0.2.6 |
Latest on Hackage: | 0.2.6 |
commonmark-extensions-0.2.6@sha256:78cd38f721dd61f9e038fc6a9180b14674a53ee1ac7cf3be822ea87e540f66a5,3582
Module documentation for 0.2.6
- Commonmark
- Commonmark.Extensions
- Commonmark.Extensions.Alerts
- Commonmark.Extensions.Attributes
- Commonmark.Extensions.AutoIdentifiers
- Commonmark.Extensions.Autolink
- Commonmark.Extensions.DefinitionList
- Commonmark.Extensions.Emoji
- Commonmark.Extensions.FancyList
- Commonmark.Extensions.Footnote
- Commonmark.Extensions.HardLineBreaks
- Commonmark.Extensions.ImplicitHeadingReferences
- Commonmark.Extensions.Math
- Commonmark.Extensions.PipeTable
- Commonmark.Extensions.RebaseRelativePaths
- Commonmark.Extensions.Smart
- Commonmark.Extensions.Strikethrough
- Commonmark.Extensions.Subscript
- Commonmark.Extensions.Superscript
- Commonmark.Extensions.TaskList
- Commonmark.Extensions.Wikilinks
- Commonmark.Extensions
commonmark-extensions
This package provides some syntax extensions for thecommonmark package:
hard_line_breaks
(treat new lines as hard breaks)smart
(smart quotes, dashes, and ellipses)strikethrough
(strikethrough)superscript
(superscript)subscript
(subscript)math
(LaTeX math)emoji
(emoji)autolinks
(autolink bare URLs and email addresses)pipe_tables
(pipe tables)footnotes
(footnotes)definition_lists
(definition lists)fancy_lists
(fancy ordered list markers (parentheses, alpha, roman)task_lists
(task lists)attributes
(attributes for all inline and block elements)raw_attribute
(special raw block and inline elements in any format)bracketed_spans
(spans of inline elements with attributes)fenced_divs
(groups of block elements with attributes)auto_identifiers
(automatic generation of identifiers for headings)auto_identifiers_ascii
(automatic generation of ASCII identifiers for headings)implicit_heading_references
(headings implicitly define link references)wikilinks_title_before_pipe
andwikilinks_title_after_pipe
(wikilink syntax)
Changes
Changelog for commonmark-extensions
0.2.6
- Track wikilinks with a class instead of the title (EvanSilberman). The use of title=“wikilink” in HTML output tracesback to Pandoc’s hijacking of the title attribute for this purposeback when Pandoc links didn’t have Attrs. A coordinated change inPandoc moves this more appropriately into a class.
0.2.5.6
- Autolink parser: track balanced brackets in path (improveson #156). We still get a link within a link, which isn’t right, but atleast the link goes to the right place. Cf. jgm/pandoc#10333.
0.2.5.5
- Fix auto_identifiers extension: it now replaces emojis withtheir aliases, as documented.
- Fix auto_identifiers_ascii extension: it now ignoresnon-ASCII characters with no ASCII equivalent.
0.2.5.4
- Fix autolink parsing regression (#151). This affects autolinks withdoubled internal line-ending punctuation characters.
0.2.5.3
- Fix rebase_relative_paths extension so it works with URLs withnon-ASCII characters (#148). Previously these would not be properlydetected as absolute URIs.
0.2.5.2
Improve autolinks extension (#147).The autolinks extension was interacting badly with explicit links,To fix this we had to make autolink parsing a bit stricter thanthe GFM spec does. They allow unbalanced
)
except at the endof a URL (which is defined as: followed by optional final punctuationthen whitespace or eof). With this change, we don’t allow unbalanced)
at all in raw URLs. This should not be a big problem in practice.Protect against quadratic generated table size explosion (Michael Howell).This commit adds a limit to the number of auto-completed cellsaround 200,000. The result is, in these original samples:
0.2.5.1
- Add
test/alerts.md
to extra-source-files in cabal file.
0.2.5
Add support for alerts extension, supporting GitHub-style alerts (#132).https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alertsNew module Commonmark.Extensions.Alerts [API change].
Do not accept footnote labels with line breaks (Michael Howell).
Parse
[^ ]
and[^]
as links (Michael Howell). This is consistent withmost other CommonMark parsers, even when they have support for footnotes turned on.
0.2.4
- Make
pipe_tables
extension treat backslash escapes like GH does (#112,Michael Howell). This change essentially changes the way the text\\|
gets parsed inside a table. In the old version, the first backslashescapes the second backslash, and then the pipe is treated as a cellseparator. In the new version, the pipe is still preceded by a backslash,so it is still literal text. The escaping rule is documented in detailin the spec for this extension. This change also aligns our escapingof pipes with GitHub’s.
0.2.3.6
Fix pipe table parser so that
|
s don’t interfere withother block structures (Michael Howell, #111, fixing #52 and#95). This parser is structured as a system that parses thesecond line first, then parses the first line. That is, ifit detects a delimiter row as the second line of aparagraph, it converts the paragraph into a table. Thisseems counterintuitive, but it works better than trying toconvert a table into a paragraph, since it might need to besomething else.Improve parsing of inline math (#110).
0.2.3.5
- Resolve entities inside wikilinks (#105, Michał Kukieła).
0.2.3.4
- Require whitespace after definition list marker (#104).Otherwise we can inadvertently clobber strikeout or subscript.
0.2.3.3
- Fix definition_lists extension (#96). We were not properly consumingindentation in definitions, which caused problems when the definitionsthemselves contained lists.
0.2.3.2
- Update lower version bounds for commonmark (#93, DavidThrane Christiansen).
0.2.3.1
math
extension: don’t fail when display math containsembedded inline math. See jgm/pandoc#7942.- Make math parsing more sophisticated.Count embeddings inside
{..}
, since math can containe.g.\text{...}
which itself contains math delimiters. - Small improvement in pipe table parsing.The old parser failed on some edge cases with extra whitespaceafter pipes (which we should just ignore).
fancy_list
extension: improve list type ambiguity resolution (#89).
0.2.3
- Allow bare word attribute in fenced_divs (#84). This follows a similarchange in pandoc (jgm/pandoc#7242).
0.2.2.1
- Fix commonmark-extensions to build with GHC 9.2 (#81, Joseph C. Sible).Currently
--allow-newer
is needed.
0.2.2
- Add footnote to gfmExtensions. Note that this also requiresadditional type constraints on gfmExtensions [API change].
0.2.1.2
- Fix bug with absolute paths in rebase_relative_pathsextension on Windows.
0.2.1.1
- Fix bug in wikilinks extensions.
0.2.1
- Add
rebase_relative_paths
extension.New exported module Commonmark.Extensions.RebaseRelativePaths [API change]. - Add
wikilinks_title_before_pipe
andwikilinks_title_after_pipe
extensions (#69).New exported module Commonmark.Extensions.Wikilinks [API change].
0.2.0.4
- Add a test for autolinks (#66).
- Require commonmark 0.1.1.2 (otherwise autolinks don’t workproperly).
0.2.0.3
- Add some new test examples to the autolinks extension spec (#65).
- Allow interior
~
characters in autolinks (#65).
0.2.0.2
Remove unnecessary Typeable constraint on
TaskList
andgfmExtensions
(#58).Fix bug in
footnote
extension: multiple blocks ina block container (e.g. block quote or list) insidea footnote were being rendered in reverse order (#63,Harald Gliebe).
0.2.0.1
- Added a missing test file to extra-source-files (#55).
0.2.0.0
Add HasQuoted class in Smart extension, with singleQuotedand doubleQuoted methods. This gives more fleibility insupporting smart quotes, and allows us to use pandoc’sQuoted elements.
Add advice to haddocks for pipeTableSpec (#52).If a line could be a candidate pipe table heading, but thefollowing line of separators is not encountered, the line istreated as a paragraph, even if it has indications of otherblock-level formatting. Putting the pipeTableSpec AFTERparsers for lists, headings, etc. causes the latter to takepriority.
0.1.0.0
- Initial release