Home Reference Source Test Repository
public class | source

MDReplacer

the Markdown Replacer class parse a markdown string to a HTML string

Test:

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

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 constructor() source

ctor

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:

NameTypeAttributeDescription
input: string

string to parse

Return:

string

parsed string

Test:

public replace(input: *): * source

the replace method splits the string in blocks and parse each line

Params:

NameTypeAttributeDescription
input *

: the whole document as string input

Return:

*

the parsed input string with all replaced tags

Test:

public replaceDouble(input:: *, key:: *): * source

If the markdown token has a start and end token, we replaces both

Params:

NameTypeAttributeDescription
input: *

string to parse

key: *

token to replace

Return:

*

parsed string with html tag at beginning and ending

Test:

public replaceKey(input:: *, key:: *): * source

replace md tokens to html tags

Params:

NameTypeAttributeDescription
input: *

string to parse

key: *

token to search

Return:

*

this method returns the string with the replaced html tags

Test:

public startsWith(input:: *, key:: *): * source

small helper method to check if the current token is a starting token

Params:

NameTypeAttributeDescription
input: *

string to check

key: *

token to check

Return:

*

the result as boolean, true if it is first else false

Test: