Skip to content

Formatting

code blocks

Plain code block

Python
1
2
3
4
import sys 

for path in sys.path:
    print(path)

admonition or callout

see the documentation.

This is the admonition title of a note

body

Markdown
1
2
!!! note "This is the admonition title of a `note`"
    body 

this is a info admonition

This is the admonition body

Markdown
1
2
!!! info "this is a `info` admonition"
    This is the admonition body
collapsable admonition - closed by default

you can close me.

Markdown
1
2
??? note "collapsable admonition - closed by default"
    you can close me.
collapsable admonition - opened by default

you can close me.

Markdown
1
2
???+ note "collapsable admonition - opened by default"
    you can close me.

grid cards

see docs

  • HTML for content and structure
  • JavaScript for interactivity
  • CSS for text running out of boxes
  • Internet Explorer ... huh?

Run using:

Markdown
1
2
3
4
5
6
7
8
<div class="grid cards" markdown>

- :fontawesome-brands-html5: __HTML__ for content and structure
- :fontawesome-brands-js: __JavaScript__ for interactivity
- :fontawesome-brands-css3: __CSS__ for text running out of boxes
- :fontawesome-brands-internet-explorer: __Internet Explorer__ ... huh?

</div>

Cards are not displayed in vscode editor, nor Obsidian.

linenums

For showing line numbers in code and for highlighting code lines.

See docs

Python
1
2
3
4
5
def bubble_sort(items):
    for i in range(len(items)):
        for j in range(len(items) - 1 - i):
            if items[j] > items[j + 1]:
                items[j], items[j + 1] = items[j + 1], items[j]

Rendered from this code:

Markdown
1
2
3
4
5
6
7
``` py linenums="1"
def bubble_sort(items):
    for i in range(len(items)):
        for j in range(len(items) - 1 - i):
            if items[j] > items[j + 1]:
                items[j], items[j + 1] = items[j + 1], items[j]
```
Python
1
2
3
4
5
def bubble_sort(items):
    for i in range(len(items)):
        for j in range(len(items) - 1 - i):
            if items[j] > items[j + 1]:
                items[j], items[j + 1] = items[j + 1], items[j]

Rendered from this code:

Markdown
1
2
3
4
5
6
7
``` py hl_lines="2 3"
def bubble_sort(items):
    for i in range(len(items)):
        for j in range(len(items) - 1 - i):
            if items[j] > items[j + 1]:
                items[j], items[j + 1] = items[j + 1], items[j]
```

Lines colors and numbers are not rendered in editor/obsidian.

tabbed

see docs

Python
1
2
3
4
from sandbox.calculations import Two_numbers

nums = Two_numbers(4, 2)
print(f'{nums.add()=}')
Text Only
1
nums.add()=6.0

rendered from this markdown code:

Markdown
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
=== "Source"

    ```python 
    from sandbox.calculations import Two_numbers

    nums = Two_numbers(4, 2)
    print(f'{nums.add()=}')
    ```

=== "Result"

    ```
    nums.add()=6.0
    ```