ramondevprivate.common.md_escape filter – Make a value safe to print in Obsidian Markdown

Note

This filter plugin is part of the ramondevprivate.common collection (version 1.0.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install ramondevprivate.common.

To use it in a playbook, specify: ramondevprivate.common.md_escape.

New in ramondevprivate.common 1.0.0

Synopsis

  • Turns a value into plain text for a Markdown line or table cell, so values set by users or third parties (key comments, image labels, UFW comments, process names) can’t change the page.

  • Control and format characters, including line breaks, become spaces.

  • \, |, `, [, ], #, $, *, _, ~, = and ^ are escaped with a backslash; <, >, % and & become HTML entities (no raw HTML, no %% comments, no formatting, no block IDs).

  • The page source shows the backslashes; Obsidian renders the plain characters.

Input

This describes the input of the filter, the value before | ramondevprivate.common.md_escape.

Parameter

Comments

Input

any / required

The value; None gives an empty string, anything else is converted to a string.

Examples

- name: A table cell
  ansible.builtin.debug:
    msg: "| {{ key_comment | ramondevprivate.common.md_escape }} |"

Return Value

Key

Description

Return value

string

The escaped text.

Returned: success

Authors

  • Ramon (@RamonDevPrivate)