Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Flavored Markdown extensions #44

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<version>7</version>
</parent>

<groupId>com.github.rjeschke</groupId>
<groupId>com.quandora</groupId>
<artifactId>txtmark</artifactId>
<version>0.14-SNAPSHOT</version>
<name>txtmark</name>
Expand All @@ -29,9 +29,9 @@
</properties>

<scm>
<connection>scm:git:git@github.com/rjeschke/txtmark.git</connection>
<developerConnection>scm:git:ssh://git@github.com/rjeschke/txtmark.git</developerConnection>
<url>git@github.com/rjeschke/txtmark.git</url>
<connection>scm:git:git@github.com/quandora/txtmark.git</connection>
<developerConnection>scm:git:ssh://git@github.com/quandora/txtmark.git</developerConnection>
<url>git@github.com/quandora/txtmark.git</url>
</scm>

<developers>
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/github/rjeschke/txtmark/BlockType.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@ enum BlockType
/** An unordered list. */
UNORDERED_LIST,
/** A XML block. */
XML
XML,
/** A GFM table */
TABLE
}
241 changes: 241 additions & 0 deletions src/main/java/com/github/rjeschke/txtmark/Decorator.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,19 @@ public interface Decorator
*/
public void closeCodeSpan(final StringBuilder out);

/**
* Called to append the content in a code span
* This will call {@link #openCodeSpan(StringBuilder)} then write the content and then call {@link #closeCodeSpan(StringBuilder)}
*
* TODO: better use a CodeSpanEmmiter?
*
* @param out
* @param in
* @param start
* @param end
*/
public void appendCodeSpan(final StringBuilder out, final String in, final int start, final int end);

/**
* Called when a headline is opened.
*
Expand Down Expand Up @@ -254,6 +267,38 @@ public interface Decorator
*/
public void closeEmphasis(final StringBuilder out);

/**
* Called when a strikeout span is opened.
*
* <p>
* Default implementation is:
* </p>
*
* <pre>
* <code>out.append("&lt;del&gt;");</code>
* </pre>
*
* @param out
* The StringBuilder to write to.
*/
public void openStrikeout(final StringBuilder out);

/**
* Called when a strikeout span is closed.
*
* <p>
* Default implementation is:
* </p>
*
* <pre>
* <code>out.append("&lt;/del&gt;");</code>
* </pre>
*
* @param out
* The StringBuilder to write to.
*/
public void closeStrikeout(final StringBuilder out);

/**
* Called when a superscript span is opened.
*
Expand Down Expand Up @@ -470,4 +515,200 @@ public interface Decorator
* The StringBuilder to write to.
*/
public void closeImage(final StringBuilder out);

/**
* Called when a table is opened.
*
* <p>
* Default implementation is:
* </p>
*
* <pre>
* <code>out.append("<table>");</code>
* </pre>
*
* @param out
* The StringBuilder to write to.
*/
public void openTable(final StringBuilder out);

/**
* Called when a table is closed.
*
* <p>
* Default implementation is:
* </p>
*
* <pre>
* <code>out.append("</table>");</code>
* </pre>
*
* @param out
* The StringBuilder to write to.
*/
public void closeTable(final StringBuilder out);

/**
* Called when a table body is opened.
*
* <p>
* Default implementation is:
* </p>
*
* <pre>
* <code>out.append("<tbody>");</code>
* </pre>
*
* @param out
* The StringBuilder to write to.
*/
public void openTableBody(final StringBuilder out);

/**
* Called when a table body is closed.
*
* <p>
* Default implementation is:
* </p>
*
* <pre>
* <code>out.append("</tbody>");</code>
* </pre>
*
* @param out
* The StringBuilder to write to.
*/
public void closeTableBody(final StringBuilder out);

/**
* Called when a table head is opened.
*
* <p>
* Default implementation is:
* </p>
*
* <pre>
* <code>out.append("<thead>");</code>
* </pre>
*
* @param out
* The StringBuilder to write to.
*/
public void openTableHead(final StringBuilder out);

/**
* Called when a table head is closed.
*
* <p>
* Default implementation is:
* </p>
*
* <pre>
* <code>out.append("</thead>");</code>
* </pre>
*
* @param out
* The StringBuilder to write to.
*/
public void closeTableHead(final StringBuilder out);

/**
* Called when a table row is opened.
*
* <p>
* Default implementation is:
* </p>
*
* <pre>
* <code>out.append("<tr>");</code>
* </pre>
*
* @param out
* The StringBuilder to write to.
*/
public void openTableRow(final StringBuilder out);

/**
* Called when a table row is closed.
*
* <p>
* Default implementation is:
* </p>
*
* <pre>
* <code>out.append("</tr>");</code>
* </pre>
*
* @param out
* The StringBuilder to write to.
*/
public void closeTableRow(final StringBuilder out);

/**
* Called when a table data is opened.
*
* <p>
* Default implementation is:
* </p>
*
* <pre>
* <code>out.append("<td>");</code>
* </pre>
*
* @param out
* The StringBuilder to write to.
* @param align one of null | left | center | right.
* If null no align is set
*/
public void openTableData(final StringBuilder out, final String align);

/**
* Called when a table data is closed.
*
* <p>
* Default implementation is:
* </p>
*
* <pre>
* <code>out.append("</td>");</code>
* </pre>
*
* @param out
* The StringBuilder to write to.
*/
public void closeTableData(final StringBuilder out);

/**
* Called when a table header is opened.
*
* <p>
* Default implementation is:
* </p>
*
* <pre>
* <code>out.append("<th>");</code>
* </pre>
*
* @param out
* The StringBuilder to write to.
* @param align one of null | left | center | right.
* If null no align is set
*/
public void openTableHeader(final StringBuilder out, final String align);

/**
* Called when a table header is closed.
*
* <p>
* Default implementation is:
* </p>
*
* <pre>
* <code>out.append("</th>");</code>
* </pre>
*
* @param out
* The StringBuilder to write to.
*/
public void closeTableHeader(final StringBuilder out);
}
Loading