com.overzealous.remark
Class Options

java.lang.Object
  extended by com.overzealous.remark.Options
All Implemented Interfaces:
Cloneable

public class Options
extends Object
implements Cloneable

This class is used to configure the Remark engine. Standard profiles have been created for a variety of Markdown processors, including:

Author:
Phil DeJarnett

Nested Class Summary
static class Options.FencedCodeBlocks
          Provides settings to configure if fenced code blocks are used.
static class Options.InWordEmphasis
          Provides options for how to handle in-word emphasis.
static class Options.Tables
          Provides settings to control how Tables are converted.
 
Field Summary
 boolean abbreviations
          If true, enable remarking abbreviations.
 boolean autoLinks
          If true, enable autoLinks.
 boolean definitionLists
          If true, enable remarking definitions lists.
 Options.FencedCodeBlocks fencedCodeBlocks
          Configures how to handle code blocks.
 int fencedCodeBlocksWidth
          Number of times to repeat the fencedCodeBlock character.
 boolean fixPegdownStrongEmphasisInLinks
          This is a very specific fix for a very specific bug.
 boolean hardwraps
          If true, <br/>s are replaced with a simple linebreak.
 boolean headerIds
          If true, enable remarking header IDs.
 Set<IgnoredHtmlElement> ignoredHtmlElements
          Allows the addition of extra HTML tags that can be left in the output.
 boolean inlineLinks
          If true, place the URLs for links inline.
 Options.InWordEmphasis inWordEmphasis
          Configures how in-word emphasis is handled.
 boolean preserveRelativeLinks
          If true, relative links are preserved.
 boolean reverseHtmlSmartPunctuation
          If true, replace all smart punctuation HTML entities (e.g: &emdash;) with simplified characters (e.g: ---).
 boolean reverseHtmlSmartQuotes
          If true, replace all smart quote HTML entities (e.g: &ldquo; with simplified characters (e.g: ").
 boolean reverseUnicodeSmartPunctuation
          If true, replace all smart punctuation unicode characters (e.g: —) with simplified characters (e.g: ---).
 boolean reverseUnicodeSmartQuotes
          If true, replace all smart quote unicode characters (e.g: “) with simplified characters (e.g: ").
 boolean simpleLinkIds
          If true, link IDs are simply incremented as they are found.
 Options.Tables tables
          Configures how tables are handled.
 
Constructor Summary
Options()
          Configures a default set of options.
 
Method Summary
 Options getCopy()
           
 Options.FencedCodeBlocks getFencedCodeBlocks()
          Always returns a non-null setting for FencedCodeBlocks
 Set<IgnoredHtmlElement> getIgnoredHtmlElements()
          Always returns a non-null setting for IgnoredHtmlElements
 Options.InWordEmphasis getInWordEmphasis()
          Always returns a non-null setting for InWordEmphasis
 Options.Tables getTables()
          Always returns a non-null setting for Tables
static Options github()
          Creates and returns a new Options set with the default options compatible with github-flavored Markdown.
static Options markdown()
          Creates and returns a new Options set with the default options compatible with the original Markdown.
static Options markdownExtra()
          Creates and returns a new Options set with the default options compatible with PHP Markdown Extra features.
static Options multiMarkdown()
          Creates and returns a new Options set with the default options compatible with MultiMarkdown features.
static Options pegdownAllExtensions()
          Creates and returns a new Options set with the default options compatible with pegdown configured with all extensions.
static Options pegdownBase()
          Creates and returns a new Options set with the default options compatible with the base pegdown configuration.
 void setReverseAllSmarts(boolean reverse)
          Utility method to set reversing of both unicode and html smart quotes and punctuation.
 void setReverseSmartPunctuation(boolean reverse)
          Utility method to set reversing of both unicode and html smart punctuation.
 void setReverseSmartQuotes(boolean reverse)
          Utility method to set reversing of both unicode and html smart quotes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hardwraps

public boolean hardwraps
If true, <br/>s are replaced with a simple linebreak.

If false, <br/>s are replaced with a two spaces followed by a linebreak (default).


inWordEmphasis

public Options.InWordEmphasis inWordEmphasis
Configures how in-word emphasis is handled.


preserveRelativeLinks

public boolean preserveRelativeLinks
If true, relative links are preserved. You must still provide a baseURI!

Otherwise, relative links are resolved against the provided baseURI (the default).


inlineLinks

public boolean inlineLinks
If true, place the URLs for links inline.

Otherwise, generate link IDs and place at the end (the default).


simpleLinkIds

public boolean simpleLinkIds
If true, link IDs are simply incremented as they are found.

Otherwise, Remark attempts to generate unique link IDs based on the link description.


tables

public Options.Tables tables
Configures how tables are handled.


reverseHtmlSmartQuotes

public boolean reverseHtmlSmartQuotes
If true, replace all smart quote HTML entities (e.g: &ldquo; with simplified characters (e.g: ").


reverseUnicodeSmartQuotes

public boolean reverseUnicodeSmartQuotes
If true, replace all smart quote unicode characters (e.g: “) with simplified characters (e.g: ").


reverseHtmlSmartPunctuation

public boolean reverseHtmlSmartPunctuation
If true, replace all smart punctuation HTML entities (e.g: &emdash;) with simplified characters (e.g: ---).


reverseUnicodeSmartPunctuation

public boolean reverseUnicodeSmartPunctuation
If true, replace all smart punctuation unicode characters (e.g: —) with simplified characters (e.g: ---).


definitionLists

public boolean definitionLists
If true, enable remarking definitions lists. When enabled, definition lists (<dl>, <dt>, and <dd>) are converted into PHP Markdown Extra style definition lists.


abbreviations

public boolean abbreviations
If true, enable remarking abbreviations. When enabled, <abbr> tags are converted into PHP Markdown Extra style abbreviations.


autoLinks

public boolean autoLinks
If true, enable autoLinks. This only affects links whose href attribute is the same as the node's inner text content. In this case, the URL is simply written directly to the output. Example:
<a href="http://www.example.com">http://www.example.com</a>
becomes
http://www.example.com


headerIds

public boolean headerIds
If true, enable remarking header IDs. When enabled, the ID of header tags will be converted into PHP Markdown Extra style header IDs.


fencedCodeBlocks

public Options.FencedCodeBlocks fencedCodeBlocks
Configures how to handle code blocks. By default, code blocks are only configured using the indented format supported by Markdown. This allows fenced code blocks when necessary.


fencedCodeBlocksWidth

public int fencedCodeBlocksWidth
Number of times to repeat the fencedCodeBlock character. (Defaults to 10.)


ignoredHtmlElements

public Set<IgnoredHtmlElement> ignoredHtmlElements
Allows the addition of extra HTML tags that can be left in the output. Please note that this does not override default handling (for example, <em> tags).


fixPegdownStrongEmphasisInLinks

public boolean fixPegdownStrongEmphasisInLinks
This is a very specific fix for a very specific bug. As of version 1.0.2, pegdown has a serious bug that really slows down when processing many links with bold and italics in the label for an anchor. This option causes Remark to replace items like [***my important link***][link-id] with just bold text, like [**my important link**][link-id]. Note: this was fixed in release 1.1.0!

See Also:
Pegdown Issue #34
Constructor Detail

Options

public Options()
Configures a default set of options. The default set is configured to be most compatible with the original Markdown syntax.

Method Detail

markdown

public static Options markdown()
Creates and returns a new Options set with the default options compatible with the original Markdown.

Returns:
Options for original Markdown compatibility

markdownExtra

public static Options markdownExtra()
Creates and returns a new Options set with the default options compatible with PHP Markdown Extra features.

Enables:

Returns:
Options for PHP Markdown Extra compatibility

multiMarkdown

public static Options multiMarkdown()
Creates and returns a new Options set with the default options compatible with MultiMarkdown features.

Enables:

Returns:
Options for MultiMarkdown compatibility

pegdownBase

public static Options pegdownBase()
Creates and returns a new Options set with the default options compatible with the base pegdown configuration.

Please note: if you are using pegdown version 1.0.2 or older, you'll need to manually enable fixPegdownStrongEmphasisInLinks.

Enables:

Returns:
Options for pegdown compatibility

pegdownAllExtensions

public static Options pegdownAllExtensions()
Creates and returns a new Options set with the default options compatible with pegdown configured with all extensions.

Please note: if you are using pegdown version 1.0.2 or older, you'll need to manually enable fixPegdownStrongEmphasisInLinks.

Enables:

Returns:
Options for pegdown compatibility

github

public static Options github()
Creates and returns a new Options set with the default options compatible with github-flavored Markdown.

Enables:

Returns:
Options for github compatibility

getFencedCodeBlocks

public Options.FencedCodeBlocks getFencedCodeBlocks()
Always returns a non-null setting for FencedCodeBlocks

Returns:
The current FencedCodeBlocks or default if not set.

getIgnoredHtmlElements

public Set<IgnoredHtmlElement> getIgnoredHtmlElements()
Always returns a non-null setting for IgnoredHtmlElements

Returns:
The current set of IgnoredHtmlElements or an empty set if null.

getTables

public Options.Tables getTables()
Always returns a non-null setting for Tables

Returns:
the current Tables or default if not set.

getInWordEmphasis

public Options.InWordEmphasis getInWordEmphasis()
Always returns a non-null setting for InWordEmphasis

Returns:
the current InWordEmphasis or default if not set.

setReverseSmartQuotes

public void setReverseSmartQuotes(boolean reverse)
Utility method to set reversing of both unicode and html smart quotes.

Parameters:
reverse - true if they should be reversed

setReverseSmartPunctuation

public void setReverseSmartPunctuation(boolean reverse)
Utility method to set reversing of both unicode and html smart punctuation.

Parameters:
reverse - true if they should be reversed

setReverseAllSmarts

public void setReverseAllSmarts(boolean reverse)
Utility method to set reversing of both unicode and html smart quotes and punctuation.

Parameters:
reverse - true if they should be reversed

getCopy

public Options getCopy()


© 2011 OverZealous Creations, LLC - BitBucket Repository