{"id":33997549,"url":"https://github.com/fabianmichael/kirby-markdown-field","last_synced_at":"2025-12-13T08:58:54.112Z","repository":{"id":37744763,"uuid":"161696715","full_name":"fabianmichael/kirby-markdown-field","owner":"fabianmichael","description":"Super-sophisticated markdown editor for Kirby 3, community built.","archived":false,"fork":false,"pushed_at":"2025-06-13T13:36:41.000Z","size":8158,"stargazers_count":164,"open_issues_count":14,"forks_count":16,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-11-07T08:25:05.684Z","etag":null,"topics":["codemirror","kirby-cms","kirby-plugin","markdown"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fabianmichael.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["fabianmichael"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2018-12-13T21:26:55.000Z","updated_at":"2025-07-09T06:00:06.000Z","dependencies_parsed_at":"2023-11-16T22:53:35.269Z","dependency_job_id":"26992966-7e94-4eda-87b6-441d874621eb","html_url":"https://github.com/fabianmichael/kirby-markdown-field","commit_stats":{"total_commits":358,"total_committers":11,"mean_commits":32.54545454545455,"dds":0.4776536312849162,"last_synced_commit":"4fc01abe20c85ce354861b8b169d35e19a488b97"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"purl":"pkg:github/fabianmichael/kirby-markdown-field","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabianmichael%2Fkirby-markdown-field","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabianmichael%2Fkirby-markdown-field/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabianmichael%2Fkirby-markdown-field/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabianmichael%2Fkirby-markdown-field/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabianmichael","download_url":"https://codeload.github.com/fabianmichael/kirby-markdown-field/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabianmichael%2Fkirby-markdown-field/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27702869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-13T02:00:09.769Z","response_time":147,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codemirror","kirby-cms","kirby-plugin","markdown"],"created_at":"2025-12-13T08:58:52.024Z","updated_at":"2025-12-13T08:58:54.105Z","avatar_url":"https://github.com/fabianmichael.png","language":"JavaScript","funding_links":["https://github.com/sponsors/fabianmichael"],"categories":[],"sub_categories":[],"readme":"# Markdown Field for Kirby\n\nEnhanced, extensible Markdown field for Kirby CMS. Now available in version 2!\n\n**Features:**\n\n- Sophisticated, but subtle highlighting for Markdown and Kirbytext\n- Context-based format toggling (almost WYSIWYG-like)\n- Smart indentation for wrapping headlines, list items, and blockquotes\n- Keyboard shortcuts for most actions\n- Custom toolbar buttons\n- Custom syntax highlights\n- Option to show whitespace characters\n- Clickable URLs\n- Configurable Markdown syntax (e.g. choose from `_italic_` or `*italic*`)\n- Replaces Kirby’s default [Markdown block](https://getkirby.com/docs/reference/panel/blocks/markdown) with one, that also supports syntax-highlighting.\n- Support for touch-based devices and great performance (thanks to [CodeMirror 6](https://codemirror.net/))\n\n💡 **TL;DR:** The Markdown field, you all have been waiting for!\n\n![Screenshot of the editor field](https://github.com/fabianmichael/kirby-markdown-field/assets/395617/590ebc77-fe2e-46ae-98f4-e565f86fc82f)\n\n## Overview\n\n\u003e This plugin is completely free and published under the MIT license. However, if you are using it in a commercial project and want to help me keep up with maintenance, please consider **[❤️ sponsoring me](https://github.com/sponsors/fabianmichael)** for securing the continued development of the plugin.\n\n## Table of Contents\n\n- [Markdown Field for Kirby](#markdown-field-for-kirby)\n  - [Overview](#overview)\n  - [Table of Contents](#table-of-contents)\n  - [1. Installation](#1-installation)\n  - [2. Setup](#2-setup)\n  - [3. Options](#3-options)\n    - [3.1. Available options](#31-available-options)\n    - [3.2. Font settings](#32-font-settings)\n    - [3.3. Buttons](#33-buttons)\n    - [3.4. Keyboard Shortcuts](#34-keyboard-shortcuts)\n      - [Block Formats](#block-formats)\n      - [Inline Formats](#inline-formats)\n      - [Other](#other)\n    - [URLs](#urls)\n    - [3.5. Pages](#35-pages)\n    - [3.6. Size](#36-size)\n  - [4. Extension API](#4-extension-api)\n    - [4.1 Custom options for pages, files, and uploads](#41-custom-options-for-pages-files-and-uploads)\n  - [5. Development](#5-development)\n  - [7. Migrating from Version 1](#7-migrating-from-version-1)\n  - [8. Known Issues](#8-known-issues)\n  - [9. What’s not supported (and never will be)](#9-whats-not-supported-and-never-will-be)\n  - [10. License](#10-license)\n  - [11. Credits](#11-credits)\n\n****\n\n## 1. Installation\n\nThis version of the plugin requires PHP 8.1 and Kirby 4.0.0 or higher. The recommended way of installing is by using Composer:\n\n```\n$ composer require fabianmichael/kirby-markdown-field\n```\n\nAlternatively, download and copy this repository to `/site/plugins/markdown-field`\n\n## 2. Setup\n\nThis field can replace any `textarea` field you have set up and works out of the box with as little config as:\n\n```yaml\neditor:\n  label: My markdown editor\n  type: markdown\n```\n\n## 3. Options\n\n### 3.1. Available options\n\nYou have access to the very same options as [the textarea field](https://getkirby.com/docs/reference/panel/fields/textarea), and a few more:\n\n| Option | Type   | Required | Default                | Description                                        |\n|:-------|:-------|:---------|:-----------------------|:---------------------------------------------------|\n| font   | string | `false`  | `monospace`            | Sets the font family (`sans-serif` or `monospace`) |\n| pages  | Object | `false`  | [see below](#35-pages) | Sets a custom query for the page selector dialog   |\n| size   | String | `false`  | `small`                | Sets the empty height of the Markdown field        |\n\n### 3.2. Font settings\n\nYou can choose between monospace (`monospace`) and sans-serif (`sans`) font. The monospace font offers a more sophisticated layout with indentation for multiline list elements, headings, and blockquote – things, which would be much harder to implement (and slower to calculate) for a proportional font.\n\nWhile the sans-serif might be more appealing to non-technical writers at first, the monospace should be the preferred version in most cases.\n\n### 3.3. Buttons\n\nThis field is packing the usual [textarea](https://getkirby.com/docs/reference/panel/fields/textarea) buttons and many more.\n\n`headlines` can contain the whole range of headings from `h1` to `h6`, and therefore accepts an array of allowed levels (default is `h1, h2, h3`). Use `headlines` as key in this case:\n\n```yaml\nbuttons:\n  headlines: # no dash before the key name\n    - h1\n    - h2\n    - h3\n    - h4\n    - h5\n    - h6\n```\n\nYou also have access to additional buttons:\n\n```yaml\nbuttons:\n  - blockquote\n  - hr\n  - strikethrough\n  - pagelink\n  - footnote\n```\n\nIf you don't need it, you can hide the toolbar. This will also disable\nthe keyboard shortcuts for all formats.\n\n```yaml\nbuttons: false\n```\n\nThe full list of available buttons. As you can see, some buttons can also have\nconfiguration options. Take the `bold` button for example. Markdown allows different\nsyntaxes for bold text, i.e. `__bold__` and `**bold**`. The editor’s syntax highlighter\nwill always recognize both, but you can adjust, what the editor will use when\nyou click the toolbar button or by hitting the respective keyboard shortcut.\n\nFor the `link` and `pagelink` buttons, you can specify whether these should insert\n`markdown` or `kirbytext` markup. By default, this will be determined by the\n[`kirbytext`](https://getkirby.com/docs/reference/system/options/kirbytext) option by\ndefault but can be overridden on a per-button basis.\n\nAll button configuration is optional, you can always use `- ul` instead of `ul: -`,\nif you want to stick to the default settings.\n\n```yaml\nbuttons:\n  headlines:\n    - h1\n    - h2\n    - h3\n    - h4\n    - h5\n    - h6\n  bold: ** # or `__`\n  link: null # or `markdown` or `kirbytext`\n  pagelink: null # or `markdown` or `kirbytext`\n  italic: * # or `_`\n  - strikethrough\n  - code\n  ul: - # or `*`/`+`\n  - ol\n  link:\n    blank: true # Show option for opening link in a new tab.\n  - blockquote\n  hr: *** # or `---`/`___`\n  - strikethrough\n  - highlight # textmarker (not supported by Kirby’s default markdown parser.)\n  - pagelink\n  - file\n  - footnote\n  - invisibles\n  - divider # can be used multiple times\n```\n\n### 3.4. Keyboard Shortcuts\n\nℹ️ Keyboard shortcuts are only available for those buttons/heading levels enabled in the toolbar.\n\n#### Block Formats\n\n| Format         | Mac/iOS        | Linux/Windows  |\n|:---------------|:---------------|:---------------|\n| Heading 1      | `⌥⌃1`          | `Alt+Shift+1`  |\n| Heading 2      | `⌥⌃2`          | `Alt+Shift+2`  |\n| Heading 3      | `⌥⌃3`          | `Alt+Shift+3`  |\n| Heading 4      | `⌥⌃4`          | `Alt+Shift+4`  |\n| Heading 5      | `⌥⌃5`          | `Alt+Shift+5`  |\n| Heading 6      | `⌥⌃6`          | `Alt+Shift+6`  |\n| Quote          | `⌥⌃q`          | `Alt+Shift+q`  |\n| Bullet List    | `⌥⌃U`          | `Alt+Shift+u`  |\n| Ordered List   | `⌥⌃O`          | `Alt+Shift+o`  |\n\n#### Inline Formats\n\n| Format                  | Mac/iOS        | Linux/Windows  |\n|:------------------------|:---------------|:---------------|\n| Bold                    | `⌘B`           | `Ctrl+b`       |\n| Italic                  | `⌘I`           | `Ctrl+i`       |\n| Link                    | `⌘K`           | `Ctrl+k`       |\n| Strikethrough           | `⌥⌃D`          | `Alt+Shift+d`  |\n| Code                    | `⌥⌃X`          | `Alt+Shift+x`  |\n| Footnote                | `⌥⌃F`          | `Alt+Shift+f`  |\n\n#### Other\n\n| Format                        | Mac/iOS        | Linux/Windows  |\n|:------------------------------|:---------------|:---------------|\n| Show Whitespace               | `⌥⌃I`          | `Alt+Shift+i`  |\n| Open clicked URL in new tab   | `⌘+Click`      | `Ctrl+Click`   |\n\n### URLs\n\n- When you select some text and paste a URL, it will automatically create a link tag and use the current selection as link text.\n\n### 3.5. Pages\n\nYou can limit the options shown in the Pagelink dialog, by setting the `pages` option with a query (if unset, you'll be able to browse the entire website tree)\n\n```yaml\npages: kirby.page('my-page').children\n```\n\nYou can also set the `pages` option to an object with other properties from [the pages field](https://getkirby.com/docs/reference/panel/fields/pages) such as info and text\n\n```yaml\npages:\n  query: kirby.page('my-page').children\n  info: \"{{ page.tags }}\"\n  text: \"{{ page.title.upper }}\"\n```\n\n### 3.6. Size\n\nYou can define the height of the field when empty. The default is `two-lines`, which mimics the textarea's default empty height.\n\nIf you want the field to mimic a text field but with some markdown highlighting on top of it, set the size to `one-line` and `buttons: false`.\n\nAll predefined sizes are:\n\n```yaml\n- one-line\n- two-lines\n- small (same as textarea)\n- medium (same as textarea)\n- large (same as textarea)\n- huge (same as textarea)\n```\n\nNote that you can make the default height any height you want with some [custom panel CSS](https://getkirby.com/docs/reference/system/options/panel#custom-panel-css). First, set the `size` option to any string you'd like:\n\n```yaml\nsize: custom-size\n```\n\nThen in your `panel.css`:\n\n```css\n.k-markdown-input-wrap[data-size=\"custom-size\"] {\n  --cm-min-lines: 20;\n}\n```\n\n## 4. Extension API\n\nThe API has changed from version 1, old plugins are not compatible anymore and require a few adjustments. See `extension-examples` folder.\n\nThere are two types of extensions, which allow you to extend the editor to adjust it better to your specific needs:\n\n- **Custom buttons:** You can define your own buttons, which can be added to the editor toolbar. Buttons can define keyboard shortcuts, display dropdowns, and even show a popup.\n- **Custom extensions:** You can define your own editor extensions. An example can be found in the `extension-examples/indent-with-tab` folder.\n- **Custom highlights:** You can define regex-based custom highlights, which allow you to highlight any text, such as markup for custom syntax (e.g. global text snippets or Wiki-style links)\n\n### 4.1 Custom options for pages, files, and uploads\n\nYour extension can use a special endpoint to extend the base options for pages, files, and uploads with parameters set in the button configuration. See an example in the `extension-examples/custom-pagelink` folder.\n\n\n```js\n// special routes to read options from the button configuration\nthis.input.endpoints.field + \"/myextension/pages\"\nthis.input.endpoints.field + \"/myextension/uploads\"\nthis.input.endpoints.field + \"/myextension/files\"\n```\n\nThe end user can configure options for your extension as part of the button configuration:\n\n```yaml\ntext:\n  type: markdown\n  files:\n    […]\n  pages:\n    […]\n  buttons:\n    myextension:\n      pages:\n        query: site.index\n        info: \"{{ page.tags }}\"\n```\n\n## 5. Development\n\n- Clone the repo\n- `cd` to your newly created folder (named `kirby-markdown-field`, or whatever you have chosen)\n- `npm install` to get all the dependencies\n- Then:\n\n```bash\n# Dev mode\nnpm run dev\n\n# Build plugin + autoprefix styles\nnpm run build\n```\n\n\u003e You **must** run the build process before pushing the repo, or else the hot-reload code will prevent it from working in any install.\n\n## 7. Migrating from Version 1\n\n- Setting available **headline levels** now works a bit differently, see [3.3. Buttons](#33-buttons). This was necessary to allow for multiple, configurable dropdowns in the future/extensions.\n- The `horizontal-rule` button was renamed to `hr`.\n- The `modals` option has been removed. Clicking the link button will always display a modal.\n- The `link` and `email` buttons have been merged into a single popup.\n- The `blank` option has been moved from the global options to the link button.\n- The **invisibles** option has been replaced by a button, called `invisibles`. Just add that to your toolbar setup instead.\n- The API for registering custom buttons has changed. See `extension-examples` folder for examples.\n- Font scaling options have been removed. Version 2 of the Markdown field only accepts `monospace` and `sans` as font options. if you need scaling of headlines, consider using Kirby’s Blocks field instead.\n- The global field options have been removed. Use field presets instead. (see \u003chttps://getkirby.com/docs/guide/blueprints/extending-blueprints#reusing-and-extending-single-fields\u003e).\n- The `direction` option has been removed. CodeMirror 6 automatically determines the current text direction of the panel.\n\n## 8. Known Issues\n\n- **Kirbytags:** In some edge cases with nested parenthesis or nested Kirbytags, the highlighting can differ from how Kirby parses the markup. This shouldn’t be an issue for most daily use cases. You can also not have multiple consecutive line breaks within Kirbytags, or the highlighter will fail. This is because of the way Markdown makes a clear separation between block and inline elements.\n- **Kirbytags in HTML blocks** are not highlighted, because CodeMirror uses its own HTML Parser for that, which deactivates all Markdown highlighting within these. Parsedown Extra supports the `markdown=\"1\"` attribute on HTML block-level elements, which is not supported by CodeMirror’s Markdown parser.\n- **Inline Format toggling:** The selection will sometimes behave in unexpected ways when dealing with very complex re-formatting. Solving this would need a more sophisticated selection/caret-tracking during all transformations. IMHO, it still works better than in most other Markdown editors and does not lead to data loss, so ¯\\\\\\_(ツ)\\_/¯.\n\n## 9. What’s not supported (and never will be)\n\nThe way Markdown is used nowadays has changed since its inception, especially since GFM (\"GitHub-Flavored Markdown\") became popular and added some elements to the language.\n\n- **Setext-style headings:** If you don’t know what these are, just forget about them. There is basic highlighting, but they are neither recognized as headings by the toolbar nor respected when changing formats. Use ATX-style headings instead (e.g. `## Heading Level 2`).\n- **Indended code blocks:** Use fenced code blocks instead.\n\n## 10. License\n\nMIT (but you are highly encouraged to **[❤️ sponsor me](https://github.com/sponsors/fabianmichael)** if this piece of software helps you to pay your bills).\n\n## 11. Credits\n\n**Text editor:**\n\n- [CodeMirror 6](https://codemirror.net/6/) by [Marijn Haverbeke](https://marijnhaverbeke.nl/)\n\n**Contributors:**\n\n@fabianmichael, @sylvainjule, @medienbaecker, @mtsknn, @nsteiner, @rasteiner, @thomasfahrland, @johannschopplich\n\n**Inspired by:**\n\n- [ProseMirror](https://prosemirror.net/) by [Marijn Haverbeke](https://marijnhaverbeke.nl/)\n- [Visual Markdown Editor for Kirby 2](https://github.com/JonasDoebertin/kirby-visual-markdown) by [Jonas Döbertin](https://github.com/JonasDoebertin)\n- [SimpleMDE for Kirby 2](https://github.com/medienbaecker/kirby-simplemde) by [Thomas Günther](https://github.com/medienbaecker)\n- [Kirby’s Writer Field](https://getkirby.com/docs/reference/panel/fields/writer) by [Bastian Allgeier](https://bastianallgeier.com/)\n- [tiptap – rich-text editor for Vue.js](https://tiptap.dev/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabianmichael%2Fkirby-markdown-field","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabianmichael%2Fkirby-markdown-field","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabianmichael%2Fkirby-markdown-field/lists"}