Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MarkedPlugin

A plugin that exposes the markdown, compact and relativeURL helper to handlebars.

Templates should parse all comments with the markdown handler so authors can easily format their documentation. TypeDoc uses the Marked (https://github.com/chjj/marked) markdown parser and HighlightJS (https://github.com/isagalaev/highlight.js) to highlight code blocks within markdown sections. Additionally this plugin allows to link to other symbols using double angle brackets.

You can use the markdown helper anywhere in the templates to convert content to html:

{{#markdown}}{{{comment.text}}}{{/markdown}}

The compact helper removes all newlines of its content:

{{#compact}}
  Compact
  this
{{/compact}}

The relativeURL helper simply transforms an absolute url into a relative url:

{{#relativeURL url}}

Hierarchy

Implements

Index

Constructors

constructor

Properties

componentName

componentName: string

The name of this component as set by the @Component decorator.

Private includePattern

includePattern: RegExp = /\[\[include:([^\]]+?)\]\]/g

The pattern used to find references in markdown.

includeSource

includeSource: string

Private includes

includes: string

The path referenced files are located in.

Private mediaDirectory

mediaDirectory: string

Path to the output media directory.

Private mediaPattern

mediaPattern: RegExp = /media:\/\/([^ "\)\]\}]+)/g

The pattern used to find media links.

mediaSource

mediaSource: string

Protected project

The project that is currently processed.

Protected reflection

The reflection that is currently processed.

Protected urlPrefix

urlPrefix: RegExp = /^(http|ftp)s?:\/\//

Regular expression to test if a string looks like an external url.

Accessors

application

owner

Methods

Protected bubble

getHighlighted

  • getHighlighted(text: string, lang?: string): string
  • Highlight the synatx of the given text using HighlightJS.

    Parameters

    • text: string

      The text taht should be highlightes.

    • Optional lang: string

      The language that should be used to highlight the string.

    Returns string

    A html string with syntax highlighting.

getOptionDeclarations

getRelativeUrl

  • getRelativeUrl(absolute: string): string

initialize

  • initialize(): void

listenTo

listenToOnce

off

  • off(): any
  • off(eventMap: EventMap, context?: any): any
  • off(name: string, callback?: EventCallback, context?: any): any

on

  • on(eventMap: EventMap, context?: any): any
  • on(eventMap: EventMap, callback?: EventCallback, context?: any, priority?: number): any
  • on(name: string, callback: EventCallback, context?: any, priority?: number): any

Protected onBeginPage

Protected onBeginRenderer

onParseMarkdown

once

  • once(eventMap: EventMap, context?: any): any
  • once(name: string, callback: EventCallback, context?: any, priority?: any): any
  • Bind an event to only be triggered a single time. After the first time the callback is invoked, its listener will be removed. If multiple events are passed in using the space-separated syntax, the handler will fire once for each event, not once for a combination of all events.

    Parameters

    • eventMap: EventMap
    • Optional context: any

    Returns any

  • Parameters

    • name: string
    • callback: EventCallback
    • Optional context: any
    • Optional priority: any

    Returns any

parseMarkdown

  • parseMarkdown(text: string, context: any): string
  • Parse the given markdown string and return the resulting html.

    Parameters

    • text: string

      The markdown string that should be parsed.

    • context: any

      The current handlebars context.

    Returns string

    The resulting html string.

stopListening

trigger

  • Trigger one or many events, firing all bound callbacks. Callbacks are passed the same arguments as trigger is, apart from the event name (unless you're listening on "all", which will cause your callback to receive the true name of the event as the first argument).

    Parameters

    Returns this

Generated using TypeDoc