Package com.overzealous.remark
Class Options
- java.lang.Object
-
- com.overzealous.remark.Options
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOptions.FencedCodeBlocksProvides settings to configure if fenced code blocks are used.static classOptions.InWordEmphasisProvides options for how to handle in-word emphasis.static classOptions.TablesProvides settings to control how Tables are converted.
-
Field Summary
Fields Modifier and Type Field Description booleanabbreviationsIf true, enable remarking abbreviations.booleanautoLinksIf true, enable autoLinks.booleandefinitionListsIf true, enable remarking definitions lists.Options.FencedCodeBlocksfencedCodeBlocksConfigures how to handle code blocks.intfencedCodeBlocksWidthNumber of times to repeat the fencedCodeBlock character.booleanfixPegdownStrongEmphasisInLinksThis is a very specific fix for a very specific bug.booleanhardwrapsIf true,<br/>s are replaced with a simple linebreak.booleanheaderIdsIf true, enable remarking header IDs.Set<IgnoredHtmlElement>ignoredHtmlElementsAllows the addition of extra HTML tags that can be left in the output.booleaninlineLinksIf true, place the URLs for links inline.Options.InWordEmphasisinWordEmphasisConfigures how in-word emphasis is handled.booleanpreserveRelativeLinksIf true, relative links are preserved.booleanreverseHtmlSmartPunctuationIf true, replace all smart punctuation HTML entities (e.g:&emdash;) with simplified characters (e.g:---).booleanreverseHtmlSmartQuotesIf true, replace all smart quote HTML entities (e.g:“with simplified characters (e.g:").booleanreverseUnicodeSmartPunctuationIf true, replace all smart punctuation unicode characters (e.g: ) with simplified characters (e.g:---).booleanreverseUnicodeSmartQuotesIf true, replace all smart quote unicode characters (e.g: ) with simplified characters (e.g:").booleansimpleLinkIdsIf true, link IDs are simply incremented as they are found.Options.TablestablesConfigures how tables are handled.
-
Constructor Summary
Constructors Constructor Description Options()Configures a default set of options.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description OptionsgetCopy()Options.FencedCodeBlocksgetFencedCodeBlocks()Always returns a non-null setting for FencedCodeBlocksSet<IgnoredHtmlElement>getIgnoredHtmlElements()Always returns a non-null setting for IgnoredHtmlElementsOptions.InWordEmphasisgetInWordEmphasis()Always returns a non-null setting for InWordEmphasisOptions.TablesgetTables()Always returns a non-null setting for Tablesstatic Optionsgithub()Creates and returns a new Options set with the default options compatible with github-flavored Markdown.static Optionsmarkdown()Creates and returns a new Options set with the default options compatible with the original Markdown.static OptionsmarkdownExtra()Creates and returns a new Options set with the default options compatible with PHP Markdown Extra features.static OptionsmultiMarkdown()Creates and returns a new Options set with the default options compatible with MultiMarkdown features.static OptionspegdownAllExtensions()Creates and returns a new Options set with the default options compatible with pegdown configured with all extensions.static OptionspegdownBase()Creates and returns a new Options set with the default options compatible with the base pegdown configuration.voidsetReverseAllSmarts(boolean reverse)Utility method to set reversing of both unicode and html smart quotes and punctuation.voidsetReverseSmartPunctuation(boolean reverse)Utility method to set reversing of both unicode and html smart punctuation.voidsetReverseSmartQuotes(boolean reverse)Utility method to set reversing of both unicode and html smart quotes.
-
-
-
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:“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 whosehrefattribute is the same as the node's inner text content. In this case, the URL is simply written directly to the output. Example:
becomes<a href="http://www.example.com">http://www.example.com</a>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
-
-
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:
- headerIDs
- Markdown Extra fencedCodeBlocks
- Markdown Extra tables
- definitionLists
- abbreviations
- 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:
- MultiMarkdown tables
- definitionLists
- 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:
- hardwraps
- 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:
- hardwraps
- Markdown Extra fencedCodeBlocks
- MultiMarkdown tables
- definitionLists
- abbreviations
- autoLinks
- reverses all Smart options
- 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:
- hardwraps
- Github fencedCodeBlocks
- tables converted to code block
- autoLinks
- 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()
-
-