superfences-ps1
MkDocs plugin that adds a configurable shell-prompt SuperFences fence with copy-safe PS1 prompt characters.
The plugin registers a custom SuperFences
fence (default name shell-ps1) that prepends a configurable PS1 prompt character to every command line. The prompt is
rendered visibly in the documentation but is never copied to the clipboard and is never selected by mouse —
the plugin injects a data-copy attribute with the raw source text so Material for MkDocs' copy button bypasses the
prompt spans entirely, and user-select: none CSS is injected to prevent mouse selection of the prompt.
Installation
pip install superfences-ps1
Or with uv:
uv add superfences-ps1
Requirements
pymdownx.superfencesmust be listed undermarkdown_extensionsinmkdocs.yaml
Usage
mkdocs.yaml configuration
plugins:
- superfences-ps1:
fence_name: shell-ps1 # fence language identifier (default: shell-ps1)
prompt_char: "$" # PS1 prompt character prepended to each line (default: $)
prompt_color: "#5fb3b3" # optional CSS color for the prompt character
markdown_extensions:
- pymdownx.superfences
Writing shell fences
Use the configured fence_name in your markdown:
```shell-ps1
echo "Hello, world!"
ls -la
```
The plugin prepends the prompt character to each non-empty line before passing the content to Pygments. The rendered output shows the prompt visually, but the copy button and mouse selection only grab the commands themselves.
Configuration options
| Option | Type | Default | Description |
|---|---|---|---|
fence_name |
str |
shell-ps1 |
The fence language identifier used in markdown |
prompt_char |
str |
$ |
The PS1 prompt character prepended to each command line |
prompt_color |
str or None |
None |
Optional CSS color value for the rendered prompt |
How it works
- On
on_config, the plugin validates thatpymdownx.superfencesis present and injects a custom fence formatter intomdx_configs["pymdownx.superfences"]["custom_fences"]. - When MkDocs processes a page containing a fenced code block with the configured
fence_name, SuperFences calls the injected formatter. - The formatter prepends
<prompt_char>to every non-empty line, then passes the result to Pygments using theconsole(BashSessionLexer) lexer. Pygments wraps the prompt in<span class="gp">and the command in additional token spans. - The formatter injects a
data-copyattribute on the wrapper<div>containing the raw (un-prompted) source. Material for MkDocs' copy button readsdata-copyin preference toinnerText, so the prompt is never included in clipboard content. - On
on_post_page, the plugin injects a<style>block into each page's<head>withuser-select: noneon.gpspans, preventing mouse selection of the prompt. Ifprompt_coloris configured, the color rule is combined into the same<style>block.
Development
git clone https://github.com/dusktreader/superfences-ps1
cd superfences-ps1
uv sync
make qa/full
License
MIT — see LICENSE.md.
Metadata
Release files for superfences-ps1 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| superfences_ps1-0.1.0.tar.gz | 5.8 kB | Without provenance | Details for superfences_ps1-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| superfences_ps1-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for superfences_ps1-0.1.0-py3-none-any.whl |
Total release size: 13.1 kB
Release files / superfences_ps1-0.1.0.tar.gz
| Download URL | superfences_ps1-0.1.0.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17334254064954d03204fb80c0c2e1e9634390934c34c07f95caecdc79803e0f
|
|
BLAKE2b-256 checksum How to use checksums |
c44c7de690a91a0d57f1f41859051474ab03f0a8a17b0832051412081147e77d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / superfences_ps1-0.1.0-py3-none-any.whl
| Download URL | superfences_ps1-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eed17bf0a457cb0333f496becc42c7f0e497d504070ba3aa29cb9816e37bfdb9
|
|
BLAKE2b-256 checksum How to use checksums |
92b7c84f4cf96a04c79d4a621be132ccdf7aff566dbbc4580c531d68bb018428
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for superfences-ps1 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.