Markdown ❺

Embed markdown content, including tables and more.

This feature brings basic Markdown capabilities into Webflow projects.

Goals

  • Support the embedding of simple, small chunks of markdown content directly in your Webflow page, including both;

    • "Chunk" format with multiple elements

    • Single-line format, where you only are using inline styles like bold, italics, highlight, strikethrough, etc.

  • Make them Embed compatible for simple editing

  • Support CMS use, within Rich Text field Embeds

  • Support Components, and component properties

Use Cases

  • Small table generation, in an easily-editable fashion

  • Small tables within blogs and other rich text content

  • Component property text formatting, such as bolding, italics, and highlighting within a property text string

Usage Notes

Rendering a block of Markdown

SA5 supports two approaches for Markdown content;

  1. Use the <markdown> or <md> element inside of any HTML Embed.

  2. Use a standard <div> with a custom attribute of wfu-markdown on it.

Here's an example of an H1 followed by a table;

<markdown>
# This is Markdown  
  
| Day | Ponsonby Doctors | Viaduct Doctors |  
| :--- | :--- | :--- |
| Mon 15th | 1pm - 5pm | 8am - 12pm |
| Tue 16th | closed | closed |
| Wed 17th | 9am- 5pm | 9am - 5pm |
| Thurs 18th | 1pm - 5pm | 8am - 12pm |
| Fri 19th | 1pm - 5pm | 8am - 12pm | 
| Sat 20th | closed | 9pm - 1pm |
| Sun 21st | closed | closed |
</markdown>

And another example, using the <div> approach;

<div wfu-markdown>
# This is more markdown

- List
  - Indented
    - And more
  - Less Indented
  
1. Numbered
2. List

> Blockquote
> here. 

</div>

Both approaches are widely-supported;

  • Works in standalone embed elements or as an embed within a rich text block

  • In rich text blocks, works with both static rich text blocks, and CMS-bound RTBs

Rendering an individual element as Markdown

In some cases, you may want only a small amount of Markdown rendered, for inline styling.

In this case, you have a two options that do not require embeds.

  1. Create a DIV, heading, or other element, and assign the custom attribute of wfu-markdown to that element ( no value is needed ).

  2. Create a custom element of type markdown or md and put your content within it as text.

Both approaches work in components, and support binding to component properties. You can then use markdown directly in the component property itself.

What Markdown Syntax is Supported?

SA5 supports;

See the markdown

Other markdown-generated styling can be similarly targeted.

Style
Markdown
Element

Italics

*Text*

<em>

Bold

**Text**

<strong>

Highlighting

==Text==

<mark>

Strikethrough

~~Text~~

<del>

Styling Your Markdown Content

Customize styling using custom CSS in an embed, like this;

<style>
[theme=default] mark {
  background-color: lightblue;
}
</style>

This targets <mark> elements which are generated with the ==highlighting== markdown syntax.

Other markdown-generated styling can be similarly targeted.

Style
Markdown
Element
CSS Selector

Italics

*Text*

em

[theme=default] em

Bold

**Text**

strong

[theme=default] strong

Highlighting

==Text==

mark

[theme=default] mark

Strikethrough

~~Text~~

del

[theme=default] del

Themes

Markdown can be themed by specifying a theme attribute, e.g.;

<markdown theme="theme1">
 ...
</markdown>

See the Themes page for more details.

Getting Started

STEP 1 - Add the Library

First, add the library as detailed in Quick Start.

STEP 2 - Apply the custom attributes as desired

See above for details.

Technical Notes & Credits

Uses Showdown.js for the Markdown conversion

In your live site, the markdown elements are initially hidden until they are processed. Users may see an empty space briefly before the markdown conversion happens.

For very large tables ( which this is not suited for ) that may result in a content layout shift.

Last updated

Was this helpful?