johannschopplich / kirby-writer-marks

Custom marks for Kirby's writer field – footnote mark included
35 stars 6 forks source link
kirby kirby-cms kirby-plugin

[!WARNING] Kirby 4 adds a lot of improvements to the writer field, including custom marks. This plugin is no longer needed and will not be maintained. Please use the native writer marks instead. Thank you!

You can still use this plugin as a boilerplate for your own custom marks in Kirby 3, although I recommend you to upgrade to Kirby 4.


Custom Writer Field Marks

Footnote mark for the Kirby writer field

This repository serves as a plugin boilerplate for extending the writer field with custom marks until Kirby natively supports them.

One of the beauties of open source is ideas are thrown out into the world to be picked up and improved upon in exchange. An older version of this plugin relied on a patcher for the panel. Roman Steiner found a way to free it from the patcher, culminating in his clever Oh Hi Mark plugin! Based on his approach I reworked my plugin boilerplate, without making use of the prototype hack.

Installation

ℹ️ Since this repo is a plugin template, I recommend you fork it and include it manually into your site/plugins folder.

Download

Download and copy this repository to /site/plugins/kirby-writer-marks.

Git submodule

git submodule add https://github.com/johannschopplich/kirby-writer-marks.git site/plugins/kirby-writer-marks

Usage

This plugin adds a custom footnote mark, which will create a <article-footnote> custom element. Styling included.

You can create custom plugins yourself. To get inspiration, head over to Kirby's official writer marks.

Custom marks are located in src/Marks and initiate inside src/index.js.

Development

ℹ️ kirbyup is used for building the Kirby Panel plugin.

Spin up the development server to watch your main script. You will have to refresh the Panel manually to see your new custom marks in the writer field.

npm run dev

Production

Build the final Panel plugin:

npm run build

Credits

License

MIT License © 2021 Johann Schopplich