rasteiner / oh-hi-mark
此软件包已被弃用,不再维护。没有建议的替代软件包。
启用自定义Writer字段标记的包含
0.1.1
2021-11-29 12:48 UTC
Requires
README
存档
Kirby oh-hi-mark 插件
启用自定义Writer字段标记的包含。这是Johann Schopplich的插件的替代方案,无需修改Kirby的panel dist文件。
安装
下载
下载并将此存储库复制到/site/plugins/oh-hi-mark
。
Git子模块
git submodule add https://github.com/rasteiner/oh-hi-mark.git site/plugins/oh-hi-mark
Composer
composer require rasteiner/oh-hi-mark
设置
此插件本身不执行任何操作。它仅提供在您自己的插件中使用自定义Writer字段标记的能力。
示例插件
从Johann Schopplich的"footnote"示例中窃取
index.php
<?php use Kirby\Cms\App as Kirby; use Kirby\Sane\Html; /* * Add `article-footnote` to Kirby's Sane class allowed tags, * otherwise the writer field content parsed by the sanitizer would * strip `article-footnote` tags (Applies to Kirby 3.6+ only). */ Html::$allowedTags['article-footnote'] = true; Kirby::plugin('rasteiner/footnote-mark', []);
index.js
panel.plugin('rasteiner/footnote-mark', { thirdParty: { marks: { // if you want this plugin to play nice with other marks plugins, // you should keep them with the following line: ...panel.plugins.thirdParty.marks || {}, footnote: { get button() { return { icon: 'quote', label: 'Footnote' } }, commands() { return () => this.toggle(); }, get name() { return "footnote"; }, get schema() { return { parseDOM: [{ tag: "article-footnote" }], toDOM: (node) => [ "article-footnote", { ...node.attrs, }, 0, ], }; } } } } })
index.css:
.k-blocks { counter-reset: footnotes; } .k-writer .ProseMirror article-footnote { color: currentColor; counter-increment: footnotes; text-decoration: underline dotted; } .k-writer .ProseMirror article-footnote::after { content: "[" counter(footnotes) "]"; color: #999; text-decoration: underline dotted white; }
许可证
MIT
致谢
- Roman Steiner,作者
- Johann Schopplich,激发了这个想法并编写了原始插件和示例