diff --git a/CHANGELOG.md b/CHANGELOG.md index b973b700f..254826f18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,36 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html), with the exception that 0.x versions can break between minor versions. +## [Unreleased] +### Added +- Support rendering GFM task list items to Markdown +- Support rendering YAML front matter to Markdown +- Alerts + - Allow customizing HTML attributes for alert title `

` tag via `AttributeProvider` + - New configuration for `AlertsExtension` to allow authors to provide custom + titles per alert. See the + [custom titles section of the alerts README](./commonmark-ext-gfm-alerts/README.md#custom-alert-titles) + for more information. + - New configuration for `AlertsExtension` to allow alerts to be nested within + other blocks (including other alerts). See + [this section of the alerts README](./commonmark-ext-gfm-alerts/README.md#nesting-alerts) + for more information. + +## [0.28.0] - 2026-03-31 +### Added +- New extension for alerts (aka callouts/admonitions) + - Syntax: + ```markdown + > [!NOTE] + > The text of the note. + ``` + - As types you can use NOTE, TIP, IMPORTANT, WARNING, CAUTION; or configure the + extension to add additional ones. + - Use class `AlertsExtension` in artifact `commonmark-ext-gfm-alerts` (#420) +- New option `maxOpenBlockParsers` for `Parser.Builder` to set an overall limit + for the depth of block parsing. If set, any nesting beyond the limit will be + parsed as paragraph text instead. The default remains unlimited. + ## [0.27.1] - 2026-01-14 ### Fixed - Line(s) after a hard line break would sometimes also get an unwanted hard @@ -83,9 +113,9 @@ with the exception that 0.x versions can break between minor versions. ### Added - New extension for footnotes! - Syntax: - ``` + ```markdown Main text[^1] - + [^1]: Additional text in a footnote ``` - Inline footnotes like `^[inline footnote]` are also supported when enabled @@ -250,7 +280,7 @@ with the exception that 0.x versions can break between minor versions. - Use class `ImageAttributesExtension` in artifact `commonmark-ext-image-attributes` - Extension for task lists (GitHub-style), thanks @dohertyfjatl - Syntax: - ``` + ```markdown - [x] task #1 - [ ] task #2 ``` @@ -518,6 +548,8 @@ API breaking changes (caused by changes in spec): Initial release of commonmark-java, a port of commonmark.js with extensions for autolinking URLs, GitHub flavored strikethrough and tables. +[Unreleased]: https://github.com/commonmark/commonmark-java/compare/commonmark-parent-0.28.0...main +[0.28.0]: https://github.com/commonmark/commonmark-java/compare/commonmark-parent-0.27.1...commonmark-parent-0.28.0 [0.27.1]: https://github.com/commonmark/commonmark-java/compare/commonmark-parent-0.27.0...commonmark-parent-0.27.1 [0.27.0]: https://github.com/commonmark/commonmark-java/compare/commonmark-parent-0.26.0...commonmark-parent-0.27.0 [0.26.0]: https://github.com/commonmark/commonmark-java/compare/commonmark-parent-0.25.1...commonmark-parent-0.26.0 diff --git a/README.md b/README.md index a917167f6..1f00e0f01 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Coordinates for core library (see all on [Maven Central]): org.commonmark commonmark - 0.27.1 + 0.28.0 ``` @@ -65,9 +65,9 @@ import org.commonmark.node.*; import org.commonmark.parser.Parser; import org.commonmark.renderer.html.HtmlRenderer; -Parser parser = Parser.builder().build(); -Node document = parser.parse("This is *Markdown*"); -HtmlRenderer renderer = HtmlRenderer.builder().build(); +var parser = Parser.builder().build(); +var document = parser.parse("This is *Markdown*"); +var renderer = HtmlRenderer.builder().build(); renderer.render(document); // "

This is Markdown

\n" ``` @@ -90,14 +90,16 @@ after this. import org.commonmark.node.*; import org.commonmark.renderer.markdown.MarkdownRenderer; -MarkdownRenderer renderer = MarkdownRenderer.builder().build(); -Node document = new Document(); -Heading heading = new Heading(); +// Build document +var heading = new Heading(); heading.setLevel(2); -heading.appendChild(new Text("My title")); +heading.appendChild(new Text("My heading")); +var document = new Document(); document.appendChild(heading); -renderer.render(document); // "## My title\n" +// Render to Markdown +var renderer = MarkdownRenderer.builder().build(); +renderer.render(document); // "## My heading\n" ``` For rendering to plain text with minimal markup, there's also `TextContentRenderer`. @@ -291,7 +293,7 @@ First, add an additional dependency (see [Maven Central] for others): org.commonmark commonmark-ext-gfm-tables - 0.27.1 + 0.28.0 ``` @@ -333,12 +335,26 @@ Enables tables using pipes as in [GitHub Flavored Markdown][gfm-tables]. Use class `TablesExtension` in artifact `commonmark-ext-gfm-tables`. +### Alerts + +Adds support for GitHub-style alerts (also known as callouts or admonitions) as described [here](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts), e.g.: + +```markdown +> [!NOTE] +> The text of the note. +``` + +As types you can use NOTE, TIP, IMPORTANT, WARNING, CAUTION; or configure the extension to add additional ones. + +Use class `AlertsExtension` in artifact `commonmark-ext-gfm-alerts`. See the +[`AlertsExtension` README](./commonmark-ext-gfm-alerts/README.md) for more information. + ### Footnotes Enables footnotes like in [GitHub](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#footnotes) or [Pandoc](https://pandoc.org/MANUAL.html#footnotes): -``` +```markdown Main text[^1] [^1]: Additional text in a footnote @@ -355,7 +371,7 @@ is based on the text of the heading. `# Heading` will be rendered as: -``` +```html

Heading

``` @@ -376,7 +392,7 @@ Use class `InsExtension` in artifact `commonmark-ext-ins`. Adds support for metadata through a YAML front matter block. This extension only supports a subset of YAML syntax. Here's an example of what's supported: -``` +```markdown --- key: value list: @@ -399,11 +415,11 @@ Adds support for specifying attributes (specifically height and width) for image The attribute elements are given as `key=value` pairs inside curly braces `{ }` after the image node to which they apply, for example: -``` +```markdown ![text](/url.png){width=640 height=480} ``` will be rendered as: -``` +```html text ``` @@ -421,12 +437,12 @@ whitespace character or the letter `x` in lowercase or uppercase, then a right b whitespace before any other content. For example: -``` +```markdown - [ ] task #1 - [x] task #2 ``` will be rendered as: -``` +```html