All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog. This project adheres to Semantic Versioning, with the exception that 0.x versions can break between minor versions.
0.14.0 - 2020-01-22
- Add
sanitizeUrlstoHtmlRenderer.Builderto enable sanitizing URLs of<a>and<img>tags. Sanitizing logic can be customized viaurlSanitizer. Thanks @VandorpeDavid
0.13.1 - 2019-11-25
- Fix potential
StackOverflowErrorfor regular expressions used in the inline parser (e.g. when parsing long HTML), thanks @lehvolk
0.13.0 - 2019-07-15
LinkReferenceDefinitionnodes are now part of the document (not rendered by default).InlineParserContext.getLinkReferenceDefinitionwas added to allow custom inline parsers to look up definitions for reference links.
- Performance improvements compared to previous version:
- Parsing 7-10% faster
- HTML rendering 105% faster - or in other words, twice as fast!
- Update to CommonMark spec 0.29 (#156):
- Change how newlines/spaces are handled in inline code
- Info strings for tilde code blocks can contain backticks and tildes
- Allow spaces inside link destinations in pointy brackets
- Disallow link destination beginning with
<unless it is inside<..> - Disallow unescaped '(' in link title in parens
- Disallow indenting list item marker by more than 3 spaces
- No longer treat
<meta>as a block tag - Link reference definitions can now be in setext headings too
- Tables extension: Changes to match GitHub implementation:
- Escaping now only considers pipe characters when parsing tables:
\|results in a literal|instead of a column, everything else is passed through to inline parsing. - Table body can now contain lazy continuation lines (without
|). An empty line or another block is needed to interrupt the table. - For tables without a body,
<tbody>is no longer rendered in HTML - See https://github.github.com/gfm/#tables-extension- for details
- Escaping now only considers pipe characters when parsing tables:
- Check non-null arguments early and provide a nicer message
- Fix incorrectly preserving HTML entities when rendering attributes
- Fix pathological case with input
[\\\\...(a lot of backslashes) - Fix pathological case with input
[]([]([](...
0.12.1 - 2018-11-13
- Speed up parsing significantly: Compared to the previous version, the benchmarks show up to 55% faster parsing for both small and large documents! (#137, #140)
- Parse backslash followed by unescapable character the same way as the reference implementations.
- Build and test on Java 11 as well.
- autolink: Stop URLs at " and ` as well
- Fix tab handling in ATX and Setext headings.
0.11.0 - 2018-01-17
- The extension for tables now also renders to plain text
(when using a
TextContentRenderer), thanks @ahjaworski
- Add
Automatic-Module-Namemanifest entries so that library can be used nicely in Java 9 modules. The module names correspond to the root package name:org.commonmark,org.commonmark.ext.autolink, etc. - Java 7 is now only supported on a best-effort basis (but it has been EOL for quite some time, so yeah)
0.10.0 - 2017-09-14
- Support multiple
DelimiterProcessorwith the same delimiter char as long as they have different length, thanks @szeiger - Add tests for thread-safety and a section to the readme (#83)
- Update to CommonMark spec 0.28 (#94):
- Adapt to changed emphasis parsing rule
- Allow nested parentheses in inline link destinations
- Fixes for text content rendering, thanks @JinneeJ:
- Support for mixed lists
- Fixed that whitespaces between text elements are removed in "stripped" mode.
For example
**text** and texthad rendered astextand text - Improved rendering for auto links
- Fix
[\]being parsed as link label - Fix
[foo](<\>)resulting in\in href - Fix multiple of 3 rule for emphasis parsing (see commonmark/cmark#177)
- Fix text node merging when opening/closing delimiters are adjacent (#96)
- autolink: Fix linking of URLs without host, e.g.
http://.(#99)
0.9.0 - 2017-03-03
- Support restricting which block types are parsed, see
enabledBlockTypesmethod onParser.Builder(#43), thanks @marksliva, @pivotal-graham-bell and @lalunamel. This allows you to disable parsing of e.g. headings, they will just be parsed as paragraphs instead. - Allow customizing the inline parser, see
inlineParserFactorymethod onParser.Builder(#68), thanks @vreynolds and @lalunamel. Note that this is experimental and currently requires using internal classes.
- Wrap escaped HTML blocks in a
<p>tag (#78) - Add missing
ext-heading-anchortodependencyManagementin parent pom, thanks @drobert
0.8.0 - 2016-12-09
- Update to CommonMark spec 0.27 (#73):
- Treat h2..h6 as HTML blocks well
- Allow shortcut reference link before open parenthesis (if parenthesis is not part of a valid inline link)
AttributeProvider.setAttributesnow has an additionaltagNameargument and is called for all HTML tags of a block. This allows users to add attributes for thepretag of a code block in addition tocode. Also added attribute provider support for additional HTML tags, namelyem,strong,codeandbr. (#74)
- ext-heading-anchor: Fix IllegalArgumentException on Android (#71)
0.7.1 - 2016-10-05
- Allow to configure prefix/suffix for ID on
HeadingAnchorExtension(#66), thanks @paulthom12345
0.7.0 - 2016-09-23
- Plain text content renderer (#58), thanks to @JinneeJ!
- Renders a plain text representation of a document instead of HTML, see
TextContentRendererin core. - Extensible in the same way as HTML rendering.
- Renders a plain text representation of a document instead of HTML, see
- Heading anchor extension (#26), thanks to @paulthom12345!
- Adds "id" attribute to heading tags (e.g.
<h1 id="heading">Heading</h1>), useful for linking to sections of a document. - ID generation logic can also be used by itself via the
IdGeneratorclass. - Use class
HeadingAnchorExtensionin artifactcommonmark-ext-heading-anchor
- Adds "id" attribute to heading tags (e.g.
- Ins (underline) extension (#54), thanks to @pabranch!
- Enables underlining of text by enclosing it in
++. It's rendered as aninstag in HTML. - Use class
InsExtensionin artifactcommonmark-ext-ins.
- Enables underlining of text by enclosing it in
HtmlRendererand related classes moved fromorg.commonmark.htmltoorg.commonmark.renderer.htmlHtmlRenderer.Builderno longer takes anAttributeProvider, but uses aAttributeProviderFactoryto instantiate a new provider for each rendering. Code needs to be changed to create a factory and then return the existing provider from itscreatemethod, similar to node renderers.NodeRendererFactorywas renamed toHtmlNodeRendererFactory, same for related classes (there's a corresponsing interface for text content rendering)
0.6.0 - 2016-07-25
- Add coverage data to build. Currently at 97 %.
- Update to CommonMark spec 0.26 (#55)
- empty list items can no longer interrupt a paragraph; this resolves an ambiguity with setext headers
- ordered lists can interrupt a paragraph only when beginning with 1
- the two-blank-lines-breaks-out-of-lists rule has been removed
- the spec for emphasis and strong emphasis has been refined to give more intuitive results in some cases
- tabs can be used after the # in an ATX header and between the markers in a thematic break
- Simplify and speed up brackets processing (links/images)
- Improves the nested brackets pathological case (e.g.
[[[[a]]]]with a lot of brackets) - Also contributed these changes upstream to commonmark.js
- Improves the nested brackets pathological case (e.g.
- Simplify merging of adjacent text nodes
- Extended
DelimiterProcessorinterface so that implementations get more information ingetDelimiterUseand can reject delimiters by returning0from it. Also rename the methods:getOpeningDelimiterChar->getOpeningCharactergetClosingDelimiterChar->getClosingCharactergetMinDelimiterCount->getMinLength
- Fix max length for link labels (999, not 1000)
- autolink: Stop URLs at more invalid characters, notably '<' and '>'. According to RFC 3987, angle brackets are not allowed in URLs, and other linkers don't seem to allow them either.
0.5.1 - 2016-05-25
- Fix
StringIndexOutOfBoundsExceptionon line after tab (#52)
0.5.0 - 2016-04-22
- Add YAML front matter extension for document metadata blocks (#24), thanks to @chiwanpark
- Add information about delimiter character and length to delimiter nodes (#10), thanks to @pcj
- Make HTML rendering for nodes extensible (#35)
- Add support for asymmetric delimiters (#17):
DelimiterProcessor#getDelimiterCharwas split intogetOpeningDelimiterCharandgetClosingDelimiterChar
- Make
AttributeProviderwork for image and table nodes (#31) - Update to CommonMark spec 0.25:
- Changes how partially consumed tabs are handled.
- Add Android test project to build so that we won't break Android support (#38), thanks to @JinneeJ
- Replace
CustomHtmlRendererwithNodeRendererwhich also allows overriding rendering for built-in node types (#35)
- Fix blank line after empty list item to terminate list
- Fix nested bullet list indented with mix of tab and spaces (#41), thanks to @derari
- Fix package name in Javadoc, thanks to @jiakuan
- autolink: Treat more special characters as trailing delimiters to not include
">,"/>and");at the end of URLs - autolink: Fix unexpected link end with unfinished delimiter pairs in URLs
- autolink: Fix Android incompatibility by not using
java.util.Objects
0.4.1 - 2016-02-11
- Fix problematic regex that doesn't work on some Java versions and Android
- Fix problems with Android (usage of
java.util.Objects,StandardCharsets, ProGuard, see #30), thanks to @JinneeJ!
- autolink extension: Update to autolink 0.3.0. This stops recognizing "abc://foo" within "1abc://foo" as a link
0.4.0 - 2016-01-18
Update to CommonMark spec 0.24 (#28):
- No longer allow whitespace between link text and link label
- Don't allow whitespace in link destination even with <>
- Don't use whitelist for schemes in autolinks, recognize all 2-32 length schemes (see spec)
- Allow multi-line content in setext headings
API breaking changes (caused by changes in spec):
- Rename
HeadertoHeading - Rename
HorizontalRuletoThematicBreak - Rename
HtmlTagtoHtmlInline - Replace
MatchedBlockParser#getParagraphStartLinewith#getParagraphContentthat returns the current content if the the matched block is a paragraph
0.3.2 - 2016-01-07
- Add more bounds checks to internal Substring class (might affect extensions)
0.3.1 - 2015-12-01
- Fix StringIndexOutOfBoundsException with unclosed inline link (#27)
0.3.0 - 2015-10-15
- Update to spec 0.22 (#14)
- Allow block parsers from extensions to override core behavior (#18)
- Fix compilation without
install(#19) - Parent pom, build and README updates
0.2.0 - 2015-08-20
- Add method
Node parseReader(java.io.Reader)toParser(#2) - Extend Javadoc and publish online (#4)
- Fix StringIndexOutOfBoundsException on some inputs (#13)
- ext-gfm-tables: Implement single-column tables (#7)
0.1.0 - 2015-07-22
Initial release of commonmark-java, a port of commonmark.js with extensions for autolinking URLs, GitHub flavored strikethrough and tables.