Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ with the exception that 0.x versions can break between minor versions.

## [Unreleased]
### Added
- More documentation with examples for `Node` classes
### Changed
### Fixed
- `MarkdownRenderer`: Fix precedence for `nodeRendererFactory`: Factories passed
Expand Down
10 changes: 10 additions & 0 deletions commonmark/src/main/java/org/commonmark/node/BlockQuote.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
package org.commonmark.node;

/**
* A block quote, e.g.:
* <pre>
* &gt; Some quoted text
* </pre>
* <p>
* Note that child nodes are themselves blocks, e.g. {@link Paragraph}, {@link ListBlock} etc.
*
* @see <a href="https://spec.commonmark.org/0.31.2/#block-quotes">CommonMark Spec</a>
*/
public class BlockQuote extends Block {

@Override
Expand Down
12 changes: 12 additions & 0 deletions commonmark/src/main/java/org/commonmark/node/BulletList.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
package org.commonmark.node;

/**
* A bullet list, e.g.:
* <pre>
* - One
* - Two
* - Three
* </pre>
* <p>
* The children are {@link ListItem} blocks, which contain other blocks (or nested lists).
*
* @see <a href="https://spec.commonmark.org/0.31.2/#list-items">CommonMark Spec: List items</a>
*/
public class BulletList extends ListBlock {

private String marker;
Expand Down
12 changes: 12 additions & 0 deletions commonmark/src/main/java/org/commonmark/node/Code.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package org.commonmark.node;

/**
* Inline code span, e.g.:
* <pre>
* Some `inline code`
* </pre>
*
* @see <a href="https://spec.commonmark.org/0.31.2/#code-spans">CommonMark Spec</a>
*/
public class Code extends Node {

private String literal;
Expand All @@ -16,6 +24,10 @@ public void accept(Visitor visitor) {
visitor.visit(this);
}

/**
* @return the literal text in the code span (note that it's not necessarily the raw text between tildes,
* e.g. when spaces are stripped)
*/
public String getLiteral() {
return literal;
}
Expand Down
3 changes: 3 additions & 0 deletions commonmark/src/main/java/org/commonmark/node/CustomBlock.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.commonmark.node;

/**
* A block that extensions can subclass to define custom blocks (not part of the core specification).
*/
public abstract class CustomBlock extends Block {

@Override
Expand Down
3 changes: 3 additions & 0 deletions commonmark/src/main/java/org/commonmark/node/CustomNode.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.commonmark.node;

/**
* A node that extensions can subclass to define custom nodes (not part of the core specification).
*/
public abstract class CustomNode extends Node {
@Override
public void accept(Visitor visitor) {
Expand Down
3 changes: 3 additions & 0 deletions commonmark/src/main/java/org/commonmark/node/Document.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.commonmark.node;

/**
* The root block of a document, containing the top-level blocks.
*/
public class Document extends Block {

@Override
Expand Down
8 changes: 8 additions & 0 deletions commonmark/src/main/java/org/commonmark/node/Emphasis.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package org.commonmark.node;

/**
* Emphasis, e.g.:
* <pre>
* Some *emphasis* or _emphasis_
* </pre>
*
* @see <a href="https://spec.commonmark.org/0.31.2/#emphasis-and-strong-emphasis">CommonMark Spec: Emphasis and strong emphasis</a>
*/
public class Emphasis extends Node implements Delimited {

private String delimiter;
Expand Down
12 changes: 12 additions & 0 deletions commonmark/src/main/java/org/commonmark/node/FencedCodeBlock.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
package org.commonmark.node;

/**
* A fenced code block, e.g.:
* <pre>
* ```
* foo
* bar
* ```
* </pre>
* <p>
*
* @see <a href="https://spec.commonmark.org/0.31.2/#fenced-code-blocks">CommonMark Spec</a>
*/
public class FencedCodeBlock extends Block {

private String fenceCharacter;
Expand Down
10 changes: 10 additions & 0 deletions commonmark/src/main/java/org/commonmark/node/HardLineBreak.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
package org.commonmark.node;

/**
* A hard line break, e.g.:
* <pre>
* line\
* break
* </pre>
* <p>
*
* @see <a href="https://spec.commonmark.org/0.31.2/#hard-line-breaks">CommonMark Spec</a>
*/
public class HardLineBreak extends Node {

@Override
Expand Down
12 changes: 12 additions & 0 deletions commonmark/src/main/java/org/commonmark/node/Heading.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
package org.commonmark.node;

/**
* A heading, e.g.:
* <pre>
* First heading
* =============
*
* ## Another heading
* </pre>
*
* @see <a href="https://spec.commonmark.org/0.31.2/#atx-headings">CommonMark Spec: ATX headings</a>
* @see <a href="https://spec.commonmark.org/0.31.2/#setext-headings">CommonMark Spec: Setext headings</a>
*/
public class Heading extends Block {

private int level;
Expand Down
8 changes: 8 additions & 0 deletions commonmark/src/main/java/org/commonmark/node/Image.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package org.commonmark.node;

/**
* An image, e.g.:
* <pre>
* ![foo](/url "title")
* </pre>
*
* @see <a href="https://spec.commonmark.org/0.31.2/#images">CommonMark Spec</a>
*/
public class Image extends Node {

private String destination;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
package org.commonmark.node;

/**
* An indented code block, e.g.:
* <pre><code>
* Code follows:
*
* foo
* bar
* </code></pre>
* <p>
*
* @see <a href="https://spec.commonmark.org/0.31.2/#indented-code-blocks">CommonMark Spec</a>
*/
public class IndentedCodeBlock extends Block {

private String literal;
Expand Down
2 changes: 1 addition & 1 deletion commonmark/src/main/java/org/commonmark/node/Link.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Note that the text in the link can contain inline formatting, so it could also contain an {@link Image} or
* {@link Emphasis}, etc.
*
* @see <a href="http://spec.commonmark.org/0.31.2/#links">CommonMark Spec for links</a>
* @see <a href="http://spec.commonmark.org/0.31.2/#links">CommonMark Spec</a>
*/
public class Link extends Node {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* They can be referenced anywhere else in the document to produce a link using <code>[foo]</code>. The definitions
* themselves are usually not rendered in the final output.
*
* @see <a href="https://spec.commonmark.org/0.31.2/#link-reference-definition">Link reference definitions</a>
* @see <a href="https://spec.commonmark.org/0.31.2/#link-reference-definition">CommonMark Spec</a>
*/
public class LinkReferenceDefinition extends Block {

Expand Down
3 changes: 3 additions & 0 deletions commonmark/src/main/java/org/commonmark/node/ListBlock.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.commonmark.node;

/**
* A list block like {@link BulletList} or {@link OrderedList}.
*/
public abstract class ListBlock extends Block {

private boolean tight;
Expand Down
5 changes: 5 additions & 0 deletions commonmark/src/main/java/org/commonmark/node/ListItem.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package org.commonmark.node;

/**
* A child of a {@link ListBlock}, containing other blocks (e.g. {@link Paragraph}, other lists, etc).
*
* @see <a href="https://spec.commonmark.org/0.31.2/#list-items">CommonMark Spec: List items</a>
*/
public class ListItem extends Block {

private Integer markerIndent;
Expand Down
12 changes: 12 additions & 0 deletions commonmark/src/main/java/org/commonmark/node/OrderedList.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
package org.commonmark.node;

/**
* An ordered list, e.g.:
* <pre><code>
* 1. One
* 2. Two
* 3. Three
* </code></pre>
* <p>
* The children are {@link ListItem} blocks, which contain other blocks (or nested lists).
*
* @see <a href="https://spec.commonmark.org/0.31.2/#list-items">CommonMark Spec: List items</a>
*/
public class OrderedList extends ListBlock {

private String markerDelimiter;
Expand Down
2 changes: 2 additions & 0 deletions commonmark/src/main/java/org/commonmark/node/Paragraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

/**
* A paragraph block, contains inline nodes such as {@link Text}
*
* @see <a href="https://spec.commonmark.org/0.31.2/#paragraphs">CommonMark Spec</a>
*/
public class Paragraph extends Block {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
package org.commonmark.node;

/**
* A soft line break (as opposed to a {@link HardLineBreak}), e.g. between:
* <pre>
* foo
* bar
* </pre>
*
* @see <a href="https://spec.commonmark.org/0.31.2/#soft-line-breaks">CommonMark Spec</a>
*/
public class SoftLineBreak extends Node {

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package org.commonmark.node;

/**
* Strong emphasis, e.g.:
* <pre><code>
* Some **strong emphasis** or __strong emphasis__
* </code></pre>
*
* @see <a href="https://spec.commonmark.org/0.31.2/#emphasis-and-strong-emphasis">CommonMark Spec: Emphasis and strong emphasis</a>
*/
public class StrongEmphasis extends Node implements Delimited {

private String delimiter;
Expand Down
10 changes: 10 additions & 0 deletions commonmark/src/main/java/org/commonmark/node/Text.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
package org.commonmark.node;

/**
* A text node, e.g. in:
* <pre>
* foo *bar*
* </pre>
* <p>
* The <code>foo </code> is a text node, and the <code>bar</code> inside the emphasis is also a text node.
*
* @see <a href="https://spec.commonmark.org/0.31.2/#textual-content">CommonMark Spec</a>
*/
public class Text extends Node {

private String literal;
Expand Down
12 changes: 12 additions & 0 deletions commonmark/src/main/java/org/commonmark/node/ThematicBreak.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
package org.commonmark.node;

/**
* A thematic break, e.g. between text:
* <pre>
* Some text
*
* ___
*
* Some other text.
* </pre>
*
* @see <a href="https://spec.commonmark.org/0.31.2/#thematic-breaks">CommonMark Spec</a>
*/
public class ThematicBreak extends Block {

private String literal;
Expand Down