1
0
silverbullet/website/Markdown/Code Widgets.md

41 lines
1.5 KiB
Markdown
Raw Normal View History

2023-11-26 11:55:33 +00:00
Code widgets are a SilverBullet-specific “extension” to [[Markdown]]. Technically, its not an extension — it just gives new meaning to markdowns native fenced code blocks — code blocks that start with a triple backtick, specifying a programming language.
2023-01-21 12:37:55 +00:00
2023-12-22 15:40:38 +00:00
Currently, SilverBullet provides two code widgets as part of its built-in [[Plugs]]:
2023-01-21 12:37:55 +00:00
* `embed`
* `markdown`
2023-12-19 15:18:33 +00:00
In addition, plugs like [[Plugs/KaTeX]] and [[Plugs/Mermaid]] add additional ones.
2023-01-21 12:37:55 +00:00
## Embed
This allows you to embed internet content into your page inside of an iframe. This is useful to, for instance, embed youtube videos. In fact, there is specific support for those.
Two examples.
2023-01-21 12:58:33 +00:00
First, embedding the silverbullet.md website inside the silverbullet.md website (inception!):
2023-01-21 12:37:55 +00:00
```embed
url: https://silverbullet.md
2023-01-21 12:58:33 +00:00
height: 500
2023-01-21 12:37:55 +00:00
```
2023-11-26 11:55:33 +00:00
and a YouTube video:
2023-01-21 12:37:55 +00:00
```embed
url: https://www.youtube.com/watch?v=VemS-cqAD5k
```
2023-11-26 11:55:33 +00:00
Note, there is specific support for YouTube videos — it automatically sets the width and height, and replaces the URL with an embed URL.
2023-01-21 12:37:55 +00:00
The body of an `embed` block is written in [[YAML]] and supports the following attributes:
* `url` (mandatory): the URL of the content to embed
* `height` (optional): the height of the embedded page in pixels
* `width` (optional): the width of the embedded page in pixels
## Markdown
2023-01-21 12:58:33 +00:00
You can embed markdown inside of markdown and live preview it. Is this useful? 🤷 Not particularly, its more of a demo of how this works. Nevertheless, to each their own, heres an example:
2023-01-21 12:37:55 +00:00
```markdown
This is going to be **bold**
```