Markdown

Native Markdown Support for BoxLang

Welcome to the BoxLang Markdown module. This provides native support for Markdown in BoxLang based on the popular Flexmark library.

# For Operating Systems using our Quick Installer.
install-bx-module bx-markdown

# Using CommandBox to install for web servers.
box install bx-markdown

Built In Functions (BIFs)

The following BIFs are available for use in your BoxLang code:

  • markdown()

  • HtmlToMarkdown()

markdown()

Converts markdown markup to HTML.

markdown( txt )

Arguments:

  • txt - The markdown text to convert to HTML

Returns:

The HTML equivalent string of the markup.

Example:

Output:

HtmlToMarkdown()

Converts HTML markup to markdown.

Arguments:

  • markup - The HTML string to convert.

Returns:

  • The markdown equivalent string of the markup.

Example:

Output:

Components

This module also provides a bx:markdown component that can be used to convert markdown to HTML in a wrapping approach. You can use it in script or in the templating language. The following attributes are available:

  • variable - The variable to store the output in. If not set, the output will be written to the response.

Example with variable:

Example with no variable, outputs to the response:

Example in the templating language using a variable:

Example in the templating language with no variable:

Settings

A subset of the flexmark options are supported. These can be configured in your boxlang.json in the modules section:

GitHub Repository and Reporting Issues

Visit the GitHub repository for release notes. You can also file a bug report or improvement suggestion via Jira.

Last updated

Was this helpful?