MDReplacer
the Markdown Replacer class parse a markdown string to a HTML string
Constructor Summary
Public Constructor | ||
public |
ctor |
Member Summary
Public Members | ||
public |
dictionary: {"## ": *, "# ": *, "**": *, "* ": *, "*": *, ">": *, " ": *} dictionary with md token and html replacement tags |
Method Summary
Public Methods | ||
public |
combineMultiLineTags(input:: string): string combine multiline list elements to one list |
|
public |
replace(input: *): * the replace method splits the string in blocks and parse each line |
|
public |
replaceDouble(input:: *, key:: *): * If the markdown token has a start and end token, we replaces both |
|
public |
replaceKey(input:: *, key:: *): * replace md tokens to html tags |
|
public |
startsWith(input:: *, key:: *): * small helper method to check if the current token is a starting token |
Public Constructors
Public Members
public dictionary: {"## ": *, "# ": *, "**": *, "* ": *, "*": *, ">": *, " ": *} source
dictionary with md token and html replacement tags
Public Methods
public combineMultiLineTags(input:: string): string source
combine multiline list elements to one list
Params:
Name | Type | Attribute | Description |
input: | string | string to parse |
public replace(input: *): * source
the replace method splits the string in blocks and parse each line
Params:
Name | Type | Attribute | Description |
input | * | : the whole document as string input |
Return:
* | the parsed input string with all replaced tags |
Test:
- this are test for the mardown replacer check empty input
- this are test for the mardown replacer check multi line input
- this are test for the mardown replacer check multi line list input
- this are test for the mardown replacer check bolt and italic input
- this are test for the mardown replacer check simple input of each type
public replaceDouble(input:: *, key:: *): * source
If the markdown token has a start and end token, we replaces both
Params:
Name | Type | Attribute | Description |
input: | * | string to parse |
|
key: | * | token to replace |
Return:
* | parsed string with html tag at beginning and ending |
public replaceKey(input:: *, key:: *): * source
replace md tokens to html tags
Params:
Name | Type | Attribute | Description |
input: | * | string to parse |
|
key: | * | token to search |
Return:
* | this method returns the string with the replaced html tags |
public startsWith(input:: *, key:: *): * source
small helper method to check if the current token is a starting token
Params:
Name | Type | Attribute | Description |
input: | * | string to check |
|
key: | * | token to check |
Return:
* | the result as boolean, true if it is first else false |