Tothom
Tothom is YAMP (Yet Another Markdown Preview) Visual Studio Code extension,
that gives you nice ▶️ Run in terminal buttons for your code blocks
Features
- Markdown preview (⇧ ⌘ P Tothom: Markdown Preview)
- ▶️ Run in terminal actions for code blocks (auto-generated)
- Alternative to run code blocks in a separate shell in the background (output appended to the preview)
- GitHub styling
- Syntax highlight for code blocks
- Dark/light mode
- ANSI escape sequences to HTML (for code block output appended to the preview)
- Follow links between local markdown files
- Anchor links
- Tasks/TODO lists (with markdown-it-task-lists)
- HTML tag attributes (with markdown-it-attrs)
- Automatic reload of the preview on edit of the source markdown file
- Independent preview tabs for each markdown file
- Force preview reload (⇧ ⌘ P Tothom: Reload Preview)
- Bind an existing terminal to a preview (a dedicated one is automatically created otherwise)
- Native VSCode Find widget enabled in the preview
Usage
- Open a markdown file that contains code blocks annotated in any of the supported languages (bash/sh/zsh), e.g.:
# Hello World!
```sh
echo 'Hello World!'
```
- Run the Tothom: Markdown Preview command (⇧ ⌘ P)
- Click on the ▶️ button automatically rendered with each of your code blocks, to run the code in the Visual Studio Code terminal.
For more examples with more markdown syntax, check the samples.
Re-use a terminal
Tothom binds each preview window to an integrated Visual Studio terminal.
When a terminal does not exist, Tothom creates a dedicated one at the time when the first ▶️ Run in terminal action is executed.
To bind a new preview window to an existing terminal, use the command ⇧ ⌘ P Tothom: Markdown Preview (existing terminal).
To re-bind a preview window to an existing terminal, activate the preview and execute the command ⇧ ⌘ P Tothom: Select terminal.
These options allow to share a terminal across multiple preview windows.
To clear the current binding of a preview to a terminal, activate the preview window and execute the command ⇧ ⌘ P Tothom: Clear terminal selection.
Run in a separate shell in the background (output appended to the preview)
Alternatively to running a code block in an integrated Visual Studio terminal, enable the option in the settings to default to running in a separate shell in the background (tothom.runInBackgroundByDefault
).
New preview windows and preview windows not yet bound to a terminal will execute code blocks in the background and the output of the executions appended to the preview window.
Keep in mind that, with this option enabled, each execution of a code block will run in an independent shell (separate child process).
To set and re-use environment variable values across multiple code blocks, enable the tothom.propagateEnv
configuration option.
This option is ignored if the preview is currently bound to a terminal (e.g. by using the 'Select terminal' command).
If needed, clear the current binding of a preview to a terminal after enabling this option by activating the preview window and executing the command ⇧ ⌘ P Tothom: Clear terminal selection.
Extension Settings
Setting |
Description |
Options/Default |
tothom.bracketedPasteMode |
Apply bracketed paste sequences on commands sent to terminal |
true (default), false |
tothom.colorScheme |
Color scheme of the preview panel |
auto (default), light , dark |
tothom.runInTerminalLabel |
Label of the Run in terminal button |
Default: ▶️ |
tothom.runInBackgroundByDefault |
Default to running code blocks in a separate child process in the background instead of the integrated terminal |
true , false (default) |
tothom.propagateEnv |
Propagates environment variables across executions when running code blocks in separate shells in the background |
true (default), false |
Limitations
Markdown syntax for code blocks only
Code block execution only works with markdown code block syntax (delimited by ```).
Tothom will not render the ▶️ Run in terminal button for code blocks written using HTML syntax (<pre>
).
Release Notes
Check the the full release notes in the Change Log.