markdownarea Component

Use the markdownarea component to create a plain-text input box where text is formatted using Markdown syntax.

{
  "type": "markdownarea",
  "text": "Hello **World**!"
}

Markdown makes it easy to add formatting - such as bolding, italics and hyperlinks without complex editing.

Tip

It's good practice to use the size shared constraint to set a desired size for this layout. This acts like a minimum size in a layout.

Properties

background
COLOUR | null
null removes the background

The background COLOUR.

font
FONT | null
null sets the default font

The FONT for this markdown area.

colour
COLOUR | null
null sets the default text colour

The text COLOUR.

linespacing
DOUBLE

The line spacing within a paragraph.

lineheightmultiple
DOUBLE

A multiplier for the natural line height.

paragraphspacing
DOUBLE

The spacing between paragraphs.

listspacing
DOUBLE

The spacing between list items.

autoadjustcontentinsets
BOOL
Default: true

Automatically adjusts the scroll view's internal content insets property to account for any overlapping title bar.

Useful if you are using external Alfred UIs with transparent title bar and full size content views.

urischemes
ARRAY
Default: "http", "https"

Override the default URI schemes which are recognised as links, for example mailto:.

This will only affect newly parsed markdown for this view, and not alter existing parsed markdown.

Important

If you set this value, you are overriding the defaults, so be sure to include http and https if you'd like these to still be recognised.

behaviour
OBJECT

Tweak the behaviour when text is added.

mode
ENUM
Default: "replace"

How to add and re-parse the specified text or src.

Value Description
"replace" Replace all the text.
"append" Append the text to the end of the current text.
"prepend" Prepend the text to the start of the current text.
"replacelast" Replace the last set text with the new text.
scroll
ENUM
Default: "none"

The scroll behaviour after setting text based on the mode.

Value Description
"none" Don't scroll on setting text.
"auto" Automatically scroll on setting text.
"start" Scroll to the start of the document on setting text.
"end" Scroll to the end of the document on setting text.
text
STRING

Text to parse based on the text mode.

src
STRING

Text to load from a file path and parse based on the text mode.

Also see Shared Properties.

Example Workflows

Parsed markdown

This example also overrides the default desired size to 300x300px.

{
  "constraints": {
    "size": {
      "width": 300,
      "height": 300
    }
  },
  "type": "markdownarea",
  "text": "# Here Is a Title\n\nAnd here is a list with:\n\n- **bold** text.\n\n- *italic* text.\n\n- Inline `code`."
}