Documentation ¶
Overview ¶
Package rendering contains all the functions used to render the information in Markup down or HTML format.
Index ¶
Constants ¶
const ( // the key for the 'content' field when the MarkupContent is converted into/from a Map ContentKey = "content" // the key for the 'markup' field when the MarkupContent is converted into/from a Map MarkupKey = "markup" )
const ( // SystemMarkupDefault Default value SystemMarkupDefault = SystemMarkupPlainText // SystemMarkupPlainText plain text SystemMarkupPlainText = "PlainText" // SystemMarkupMarkdown Markdown SystemMarkupMarkdown = "Markdown" // SystemMarkupJiraWiki JIRA Wiki SystemMarkupJiraWiki = "JiraWiki" )
Variables ¶
This section is empty.
Functions ¶
func IsMarkupSupported ¶
IsMarkupSupported indicates if the given markup is supported
func MarkdownCommonHighlighter ¶
MarkdownCommonHighlighter uses the blackfriday.MarkdownCommon setup but also includes code-prettify formatting of BlockCode segments
func NilSafeGetMarkup ¶
NilSafeGetMarkup returns the given markup if it is not nil nor empty, otherwise it returns the default markup
func RenderMarkupToHTML ¶
RenderMarkupToHTML converts the given `content` in HTML using the markup tool corresponding to the given `markup` argument or return nil if no tool for the given `markup` is available, or returns an `error` if the command was not found or failed.
Types ¶
type MarkupContent ¶
MarkupContent defines the raw content of a field along with the markup language used to input the content.
func NewMarkupContent ¶
func NewMarkupContent(content, markup string) MarkupContent
NewMarkupContent creates a MarkupContent from the given content, using the default markup.
func NewMarkupContentFromLegacy ¶
func NewMarkupContentFromLegacy(content string) MarkupContent
NewMarkupContentFromLegacy creates a MarkupContent from the given content, using the default markup.
func NewMarkupContentFromMap ¶
func NewMarkupContentFromMap(value map[string]interface{}) MarkupContent
NewMarkupContentFromMap creates a MarkupContent from the given Map, filling the 'Markup' field with the default value if no entry was found in the input or if the given markup is not supported. This avoids filling the DB with invalid markup types.
func NewMarkupContentFromValue ¶
func NewMarkupContentFromValue(value interface{}) *MarkupContent
NewMarkupContentFromValue creates a MarkupContent from the given value, by converting a 'string', a 'map[string]interface{}' or casting a 'MarkupContent'. Otherwise, it returns nil.
func (*MarkupContent) ToMap ¶
func (markupContent *MarkupContent) ToMap() map[string]interface{}