An open API service indexing awesome lists of open source software.

https://github.com/samrocketman/mkdocs-live-wysiwyg-plugin

WYSIWYG docs editor for Mkdocs Material themed docs. A content editing experience.
https://github.com/samrocketman/mkdocs-live-wysiwyg-plugin

Last synced: 3 months ago
JSON representation

WYSIWYG docs editor for Mkdocs Material themed docs. A content editing experience.

Awesome Lists containing this project

README

          

# mkdocs-live-wysiwyg-plugin

[![PyPI - Version](https://img.shields.io/pypi/v/mkdocs-live-wysiwyg-plugin)](https://pypi.org/project/mkdocs-live-wysiwyg-plugin/)
[![VS Code Marketplace](https://img.shields.io/visual-studio-marketplace/v/mkdocs-wysiwyg.mkdocs-wysiwyg?label=vscode)](https://marketplace.visualstudio.com/items?itemName=mkdocs-wysiwyg.mkdocs-wysiwyg)
[![Open VSX](https://img.shields.io/open-vsx/v/mkdocs-wysiwyg/mkdocs-wysiwyg)](https://open-vsx.org/extension/mkdocs-wysiwyg/mkdocs-wysiwyg)

An all-in-one editor for GitHub and mkdocs documentation. Available from an
extension store above or from GitHub release. Alternately available as a simple
shell script.

Right click on `mkdocs.yml` to start the mkdocs server and start editing files directly from the mkdocs interface.

๐Ÿ“ A small CLI tutorial (click to expand)

1. Add [techdocs-preview.sh][1] to your `$PATH`.
2. Edit documentation across your projects.

## Try it out

Run `./techdocs-preview.sh` from this repository to view the documentation for this repository.

For a general tutorial, you can run the following command in an empty directory.

```bash
techdocs-preview.sh init
```

- `init` will initialized mkdocs documentation for any project.
- The tutorial itself provides a starting point for docs as well as teaching material. About a 15 mins read.

I modify GitHub documentation for this repository with the following command.

```bash
techdocs-preview.sh -c -a docs
```

## Features

A WYSIWYG (What-You-See-Is-What-You-Get) editor for editing `mkdocs` documentation.

- ๐ŸŒˆโœจ Author quality of life features
- ๐Ÿ‘-๐Ÿ‘ Focus mode with collapsible nav sidebar, editing tools, and table of contents.
- ๐Ÿ“ Non-destructive editing is a top priority. Minimal `git diff` .
- ๐Ÿงœ Mermaid diagram editor with a unique feature: text on diagrams can be clicked to auto-select matching mermaid text. Enables fast editing of existing diagrams.
- ๐Ÿ—‚๏ธ File management: reorder files, content migrations, dead link scanning (for broken internal or external links), preview and manage images. Refactors links to documents and intra-document links when headings are renamed.
- ๐Ÿ”— A URL pasted onto selected text creates a markdown link. Headings can be copied to create intra-document links. Hold Ctrl key to open links with a click.
- ๐Ÿน๐ŸคŒ Unified editor actions for WYSIWYG and Markdown modes (i.e. switching modes).
- ๐Ÿ—ก Loss-less undo/redo history with a UI to access full redo history. Switching modes has shared undo history.
- ๐Ÿ Cursor location memory: switching modes keeps cursor and scroll area in same document location.
- ๐Ÿ›ฐ Text selections are preserved when the author switches modes.
- ๐Ÿ’ช Mkdocs/backage rendering features
- โœ… Toggle-able checklists (task lists): `- [ ]` and `- [x]` .
- โœ… YAML frontmatter preserved when editing and switching modes.
- โœ… MkDocs admonitions (`!!! note`, `!!! warning`, etc.) with settings gear for type, collapsible, placement, and more.
- โœ… Markdown link styles preserved (inline, reference, shortcut).
- โœ… Code blocks with WYSIWYG editable titles, language selector, and auto-indent settings.
- โœ… Mermaid diagram editing with an embedded live editor (full-screen overlay).
- โœ… Tables with contextual toolbar: insert/delete rows and columns, column alignment, and formatting settings.
- โœ… Image dialog with autocomplete from the docs tree.
- โœ… Emoji shortcode completion and full emoji picker.
- โœ… Automated content migration to mkdocs-nav-weight.
- โ„น๏ธ Other noteworthy features
- โœ… Auto-conversions: inline typing of markdown syntax creates formatted text.
- โœ… Balanced ASCII table formatting with configurable max width and per-table overrides.
- โœ… Context-sensitive help panel (Ctrl+?). Not as good as clippy ๐Ÿ“Ž.
- โœ… No external JavaScript; all assets are bundled locally within the mkdocs plugin.

The following is an annotated screenshot after running `techdocs-preview.sh init`.

![Screen Shot](docs/images/focus-busy.png)

## MkDocs Theme Support

Only the [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) theme is officially supported. Admonition styling and icons rely on Material theme CSS. Other themes may work but have not been tested.

**No breaking changes** to Material theme compatibility are allowed.

Support for admonition syntax (e.g. `!!! note`, `!!! warning`, etc.). Admonitions render as they would when the site is built by mkdocs. Collapsible admonitions (`??? type`) and HTML details tags (`!!! details`) are also supported.

## Attributions

This plugin incorporates or depends on the following works:

| Component | Author | License | Link |
| -------------------------- | -------------------------- | ------- | -------------------------- |
| **@celsowm/markdown-wysiwyg** (WYSIWYG editor) | Celso Fontes | MIT | [GitHub](https://github.com/celsowm/markdown-wysiwyg) ยท [npm][2] |
| **marked** (Markdown parser) | Christopher Jeffrey, MarkedJS | MIT | [GitHub](https://github.com/markedjs/marked) ยท [marked.js.org](https://marked.js.org) |
| **js-yaml** (YAML parser) | Vitaly Puzrin | MIT | [GitHub](https://github.com/nodeca/js-yaml) |
| **mermaid** (Diagram renderer) | Knut Sveidqvist | MIT | [GitHub](https://github.com/mermaid-js/mermaid) ยท [mermaid.js.org](https://mermaid.js.org) |
| **mermaid-live-editor** (Diagram editor) | Knut Sveidqvist | MIT | [GitHub](https://github.com/mermaid-js/mermaid-live-editor) |
| **mkdocs-live-edit-plugin** (required dependency) | Eddy Luten | MIT | [GitHub][3] |

All listed components are distributed under the MIT License. See each project's repository for full license text.

All vendored JavaScript, CSS, and application builds are bundled locally in `mkdocs_live_wysiwyg_plugin/vendor/` โ€” no external JavaScript or CSS is loaded at runtime. See [`vendor/README.md`](mkdocs_live_wysiwyg_plugin/vendor/README.md) for exact versions and license files.

[1]: https://raw.githubusercontent.com/samrocketman/mkdocs-live-wysiwyg-plugin/refs/heads/main/techdocs-preview.sh
[2]: https://www.npmjs.com/package/@celsowm/markdown-wysiwyg
[3]: https://github.com/eddyluten/mkdocs-live-edit-plugin