Skip to content

mbarkhau/markdown-svgbob

Repository files navigation

logo

This is an extension for Python Markdown which renders diagrams using svgbob.

You can try it out using the Svgbob Editor or the AsciiGrid Editor.

Project/Repo:

MIT License Supported Python Versions CalVer v202406.1023 PyPI Version PyPI Downloads

Code Quality/CI:

GitHub CI Status GitLab CI Status Type Checked with mypy Code Coverage Code Style: sjfmt

Name role since until
Manuel Barkhau (mbarkhau@gmail.com) author/maintainer 2019-04 -

Install

$ pip install markdown-svgbob

This package includes the following binaries:

  • svgbob_0.5.5_x86_64-Darwin
  • svgbob_0.5.5_x86_64-Linux
  • svgbob_0.5.5_x86_64-Windows.exe

If you are on another platform, or want to use a more recent version of svgbob_cli, you will need to install rust and then svgbob via cargo.

$ curl https://sh.rustup.rs -sSf | sh   # see https://rustup.rs/
$ cargo install svgbob_cli

This extension will always use the installed version of svgbob if it is available.

Usage

In your markdown text you can define the block:

```bob
     .---.
    /-o-/--
 .-/ / /->
( *  \/
 '-.  \
    \ /
     '
```

The info string bob is chosen to match spongedown.

Development/Testing

$ git clone https://github.com/mbarkhau/markdown-svgbob
$ cd markdown-svgbob
$ make conda
$ make lint mypy test

MkDocs Integration

In your mkdocs.yml add this to markdown_extensions.

markdown_extensions:
  - markdown_svgbob:
      tag_type: inline_svg
      bg_color: white
      fg_color: black
      min_char_width: 80

Valid options for tag_type are inline_svg (the default), img_utf8_svg and img_base64_svg.

The option min_char_width allows you to create diagrams of a uniform scale.