Skip to content

malys/silverbullet-mindmap

Repository files navigation

NPM Version GitHub Release

Silverbullet plug for mindmap diagram (online)

silverbullet-mindmap is a Plug for Silverbullet to render mindmap diagrams based on Markmap.

Note: The Markmap library itself is not bundled with this plug, it pulls the JavaScript from the JSDelivr CDN. This means this plug will not work without an Internet connection. The reason for this is primarily plug size (bundling the library would amount to 1.1MB). This way Markmap is only loaded on pages with actual mindmap diagrams rather than on every SB load.

Installation

If you run SilverBullet using Docker, Git is already included. Otherwise install Git from your system's package manager, or following Git documentation.

Open your PLUGS note in SilverBullet and add this plug to the list:

  • Stable version:
- ghr:malys/silverbullet-mindmap
  • Development version (only for testing):
- github:malys/silverbullet-mindmap/mindmap.plug.js

Then run the {[Plugs: Update]} command and off you go!

Dependencies

Dev

Production

Usage

Create a markdwon file using MarkMap format.

---
title: markmap
markmap:
colorFreezeLevel: 2
---

## Links

-[Website](https://markmap.js.org/)
- [GitHub](https://github.com/gera2ld/markmap)

## Related Projects

-[coc-markmap](https://github.com/gera2ld/coc-markmap) for Neovim
- [markmap-vscode](https://marketplace.visualstudio.com/items?itemName=gera2ld.markmap-vscode) for VSCode
- [eaf-markmap](https://github.com/emacs-eaf/eaf-markmap) for Emacs

## Features

Note that if blocks and lists appear at the same level, the lists will be ignored.

### Lists

-**strong** ~~del~~ *italic* ==highlight==
- `inline code`
- [x] checkbox
- Katex: $x = {-b \pm \sqrt{b^2-4ac} \over 2a}$ `<!-- markmap: fold -->`
- [More Katex Examples](#?d=gist:af76a4c245b302206b16aec503dbe07b:katex.md)
- Now we can wrap very very very very long text based on `maxWidth` option
- Ordered list
1. item 1
2. item 2

### Blocks

``js     console.log('hello, JavaScript')     ``
Products Price
Apple 4
Banana 2
![](https://markmap.js.org/favicon.png)

Command

  • {[Mindmap Preview: Toggle]} or [CTRL+m]

Rendering

Versionning

This plug is versioned including Semantic Versions of 3 different components:

internal version-markmap version-silverbullet version

Contributing

If you find bugs, report them on the issue tracker on GitHub.

I WILL NOT IMPLEMENT MORE FEATURES, PULL REQUESTS ARE PREFERRED.

Building from source

To build this plug, make sure you have SilverBullet installed. Then, build the plug with:

  • Deno build (update dependencies)
deno run build
  • Watch for changes and rebuild automatically
deno run watch
  • Copy the resulting .plug.js file into your space's _plug folder. Or build and copy in one command:
deno run debug
  • Release a new version
deno run release
  • Publish a new version
deno run publish

SilverBullet will automatically sync and load the new version of the plug (or speed up this process by running the {[Sync: Now]} command).

Templating

scripts/dependencies.xsh is a script used to update template files. It downloads the latest version of each dependency and replaces the placeholders (_VERSION_) in the template with the new versions.

  • scripts/import_map.tpl is the template used to generate the import_map.json file. It contains a list of dependencies to be included in the plug. The template can be edited to add or remove dependencies.
  • mindmap.plug.js is also updated with last dependencies versions.

License

MIT, following SilverBullet

Thanks

Inspired by Markdown Plug from @Zef Hemel