> getNodeTypes() {
// Return the node types we want to use this renderer for.
return Set.of(IndentedCodeBlock.class);
}
@Override
public void render(Node node) {
// We only handle one type as per getNodeTypes, so we can just cast it here.
IndentedCodeBlock codeBlock = (IndentedCodeBlock) node;
html.line();
html.tag("pre");
html.text(codeBlock.getLiteral());
html.tag("/pre");
html.line();
}
}
```
--------------------------------
### Markdown to HTML Conversion Example
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt
Illustrates how Markdown with list indicators and code spans is parsed into HTML. Block structure takes precedence over inline code.
```markdown
- `one
- two`
```
```html
```
--------------------------------
### List Item Indentation Example 3
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt
Illustrates that when there are multiple spaces after the list marker and content is indented, it may be treated as code if the indentation is not sufficient for a paragraph.
```example
- one
two
.
```
```html
two
```
--------------------------------
### List Item Wrapping in Paragraph Tags
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt
Presents examples of Markdown lists that raise questions about when list items should be wrapped in tags, and whether lists can be partially 'loose' or 'tight'.
```markdown
1. one
2. two
3. three
```
```markdown
1. one
- a
- b
2. two
```
--------------------------------
### List Items Including Section Headings
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt
Shows a Markdown example where a list item contains a section heading, questioning its validity based on different implementation behaviors.
```markdown
- # Heading
```
--------------------------------
### Invalid List Item Markers
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt
Shows examples where text following a list marker is not indented by at least one space, resulting in the text being parsed as paragraphs rather than list items.
```example
-one
2.two
.
```
```html
-one
2.two
```
--------------------------------
### Parsing Simple Open Tags
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt
Demonstrates basic open tag parsing in CommonMark.
```text
.
```
--------------------------------
### List Item with Multiple Blank Lines Between Blocks
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt
Demonstrates that a list item can contain blocks separated by more than one blank line, showing 'foo' and 'bar' as separate paragraphs within the same list item.
```example
- foo
bar
.
```
```html
```
--------------------------------
### Right-Flanking Delimiter Runs
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt
Examples of delimiter runs that are right-flanking but not left-flanking.
```markdown
abc***
abc_
"abc"**
"abc"_
```
--------------------------------
### Left-Flanking Delimiter Runs
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt
Examples of delimiter runs that are left-flanking but not right-flanking.
```markdown
***abc
_abc
**"abc"
_"abc"
```
--------------------------------
### Non-Flanking Delimiter Runs
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt
Examples of delimiter runs that are neither left nor right-flanking.
```markdown
abc *** def
a _ b
```
--------------------------------
### Link Destination Space Handling
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt
Shows how spaces in link destinations are handled when using pointy brackets.
```markdown
[link](/my uri)
.
[link](/my uri)
```
```markdown
[link]()
.
link
```
--------------------------------
### Bump Project Version
Source: https://github.com/commonmark/commonmark-java/wiki/Releasing
Execute this command when performing a minor version update to set the new snapshot version.
```bash
mvn versions:set -DnewVersion=0.yy.0-SNAPSHOT
```
--------------------------------
### Task List Items Syntax
Source: https://github.com/commonmark/commonmark-java/blob/main/README.md
Illustrates the syntax for creating task list items, indicated by `[ ]` for incomplete tasks and `[x]` for completed tasks. Requires `TaskListItemsExtension`.
```markdown
- [ ] task #1
- [x] task #2
```
--------------------------------
### Basic Code Span
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt
A simple example of a code span using single backticks.
```markdown
`foo`
.
foo
```
--------------------------------
### Bullet List Delimiter Change
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt
Changing the bullet character starts a new list block.
```markdown
- foo
- bar
+ baz
.
```
--------------------------------
### Inline HTML Tag Handling
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt
Shows that end tags can appear on the same line as start tags.
```markdown
*foo*
.
foo
```
--------------------------------
### List as First Block in List Item
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt
Demonstrates nesting a list as the initial content within another list item.
```markdown
- - foo
```
```html
```
--------------------------------
### Ordered List Delimiter Change
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt
Changing the ordered list delimiter starts a new list block.
```markdown
1. foo
2. bar
3) baz
.
- foo
- bar
- baz
```
--------------------------------
### URI Autolink with Relative Path Components
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt
Demonstrates an autolink that includes relative path components like '..'.
```CommonMark
.
https://../
```
--------------------------------
### Basic Fenced Code Block with Tildes
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt
Demonstrates a simple fenced code block using tildes. The content is treated as literal text.
```markdown
~~~
<
>
~~~
```
--------------------------------
### PHP Processing Instruction
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt
Demonstrates a type 3 processing instruction block.
```markdown
';
?>
okay
.
';
?>
okay
```
--------------------------------
### Thematic Break Examples
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/spec.txt
Demonstrates how different Markdown syntaxes are interpreted as thematic breaks (horizontal rules).
```markdown
---
---
```
```markdown
- foo
-----
```
```markdown
foo
---
```
```markdown
> foo
-----
```
--------------------------------
### Parsing Closing Tags
Source: https://github.com/commonmark/commonmark-java/blob/main/commonmark-test-util/src/main/resources/gfm-spec.txt
Demonstrates standard closing tag parsing.
```text