fediverse_pasture_inputs.utils
fediverse_pasture_inputs.utils
escape_markdown(text)
Escapes markdown characters, necessary to display markdown (as done for firefish)
Source code in fediverse_pasture_inputs/utils.py
format_as_json(data, small=False)
Displays a dictionary as pretty printed json.
>>> format_as_json({"x": 1})
['<pre
style="line-height:1;">{</pre><pre
style="line-height:1;"> "x": 1</pre><pre
style="line-height:1;">}</pre>']
Parameters:
Name | Type | Description | Default |
---|---|---|---|
small
|
If true sets font-size to 75%. |
False
|
Source code in fediverse_pasture_inputs/utils.py
is_supported(item)
Returns ✅ is item exists
pre_format(text, pre_wrap=False)
Escapes html text to pre formatted markdown
>>> pre_format(True)
['true']
>>> pre_format('<b>bold</b>\n<i>italic</i>')
['<pre><b>bold</b></pre><pre><i>italic</i></pre>']
Source code in fediverse_pasture_inputs/utils.py
pre_wrapped(x, pre_wrap)
safe_first_element(item)
Returns the first element of a list, otherwise None