{"id":13553527,"url":"https://github.com/cosmocode/dokuwiki-plugin-prosemirror","last_synced_at":"2025-07-20T20:07:52.809Z","repository":{"id":14384608,"uuid":"76461429","full_name":"cosmocode/dokuwiki-plugin-prosemirror","owner":"cosmocode","description":"A modern WYSIWYG editor for DokuWiki","archived":false,"fork":false,"pushed_at":"2024-11-21T22:53:45.000Z","size":2488,"stargazers_count":56,"open_issues_count":47,"forks_count":21,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-03T05:32:02.972Z","etag":null,"topics":["dokuwiki","dokuwiki-plugin","javascript","php","wysiwyg-editor"],"latest_commit_sha":null,"homepage":"https://wysiwyg.wiki.cosmocode.de/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cosmocode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2016-12-14T13:20:56.000Z","updated_at":"2025-03-24T00:42:07.000Z","dependencies_parsed_at":"2023-11-01T13:32:45.900Z","dependency_job_id":"1ad92c59-10ba-453b-9615-064e11700fca","html_url":"https://github.com/cosmocode/dokuwiki-plugin-prosemirror","commit_stats":null,"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"purl":"pkg:github/cosmocode/dokuwiki-plugin-prosemirror","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cosmocode%2Fdokuwiki-plugin-prosemirror","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cosmocode%2Fdokuwiki-plugin-prosemirror/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cosmocode%2Fdokuwiki-plugin-prosemirror/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cosmocode%2Fdokuwiki-plugin-prosemirror/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cosmocode","download_url":"https://codeload.github.com/cosmocode/dokuwiki-plugin-prosemirror/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cosmocode%2Fdokuwiki-plugin-prosemirror/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266189677,"owners_count":23890065,"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","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":["dokuwiki","dokuwiki-plugin","javascript","php","wysiwyg-editor"],"created_at":"2024-08-01T12:02:27.253Z","updated_at":"2025-07-20T20:07:52.788Z","avatar_url":"https://github.com/cosmocode.png","language":"PHP","funding_links":[],"categories":["JavaScript","javascript"],"sub_categories":[],"readme":"# prosemirror Plugin for DokuWiki\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/cosmocode/dokuwiki-plugin-prosemirror/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/cosmocode/dokuwiki-plugin-prosemirror/?branch=master)\n\nA WYSIWYG editor for DokuWiki\n\nAll documentation for this plugin can be found at\nhttps://www.dokuwiki.org/plugin:prosemirror\n\nIf you install this plugin manually, make sure it is installed in\n``lib/plugins/prosemirror/`` - if the folder is called different it\nwill not work!\n\nPlease refer to http://www.dokuwiki.org/plugins for additional info\non how to install plugins in DokuWiki.\n\n## Development Setup\n\nUse yarn to install the dependecies\n\n    yarn\n\nCreate a develoment bundle:\n\n    yarn dev\n\nAutomatically recreate the bundle during development:\n\n    yarn watch\n\nBuild a release\n\n    yarn build\n\nWe really recommend yarn, but npm should work, too.\n\n## Architecture\n\n### Dataflow\n\n#### Begin Edit-Session: DokuWiki -\u003e Prosemirror\n- `action/editor.php`: `HTML_EDITFORM_OUTPUT` get Instructions and render them to json\n  - see `renderer.php`\n  - `renderer.php` uses the classes `NodeStack` `Node` and `Mark` in `schema` to do its job\n    - this should possibly renamed\n  - to keep information about a Node in as few places as possible,\n  some rendering instructions have been moved to the respective `parser/` classes\n- Prosemirror parses that json in `script/main.js` according to the schema defined in\n`script/schema.js` and creates its `doc`-Node from it.\n\n#### Rendering: Prosemirror -\u003e DokuWiki -\u003e Prosemirror\n- Some Nodes (e.g. images, links) need to be resolved by DokuWiki in order to be rendered properly.\n- So ProseMirror makes ajax requests\n  - triggered by `LinkForm.resolveSubmittedLinkData` in `script/LinkForm.js`\n- the request is handled by `action/ajax.php` which resolves the link/images and returns\nthe resolved html to be rendered into Prosemirror\n\n\n#### Saving/Preview: Prosemirror -\u003e DokuWiki\n- Prosemirror synchronizes all changes with the underlying json in the `\u003cinput\u003e` field\n- When the Editform is submitted that data has to be parsed by DokuWiki into DokuWiki-Syntax.\n- This starts in `action/parser.php` during the event `ACTION_ACT_PREPROCESS`\n  - The main challenge is that Prosemirror operates on a flat array, whereas DokuWiki-Syntax is usually a tree\n  - This means that the Syntax `**bold __underlined and bold__**` is represented in Prosemirror's data as\n  `[{text: \"bold \", marks: [bold]}, {text: \"underlined and bold\", marks: [bold, underlined]}]`\n  - The creation of that syntax tree is started in `parser/SyntaxTreeBuilder.php`\n  - Handling marks is complex and subtle:\n    - To know in which order we have to open/close marks we need to know which start\n    earlier or end later\n    - for this purpose, `InlineNodeInterface::getStartingNodeMarkScore($markType)`\n    and `Mark::tailLength` play together\n    - for `getStartingNodeMarkScore()` to work, it needs the inline nodes inside a block node to be\n    chained together, so we can ask the previous node whether it has a given node or not\n    - If the marks on a node have the same start/end than they need a stable order in which they appear.\n    That is defined in `Mark::markOrder`\n\n### Our Prosemirror JS setup\nCurrently all our prosemirror scripts are in `script/`.\nThis definietly needs some better organisation.\nI can see the following possible groups:\n- NodeViews and Forms\n  - if a Node cannot be simply rendered and edited by ProseMirror, it needs a NodeView\n  - Examples are links, images, footnotes(NodeView not yet implemented)\n  - possibly also `\u003ccode\u003e` and `\u003cfile\u003e`?\n- Menu-Related classes and menu items\n- keyboard commands\n- possibly `commands` in general wich then can be used by menu-items and keyboard-events?\n- the schema\n\nThese files are compiled with webpack and transpiled with Babel into `lib/bundle.js`,\nwhich is the file actually included by DokuWiki.\n\n## Testing\nThe central test-data is the collection of DokuWiki-Syntax and corresponding Prosemirror JSON\nin `_test/json/`. This data is used for three sets of tests:\n1. Testing the rendering of DokuWiki-Syntax to Prosemirror JSON in `_test/renderer.test.php`\n1. Testing the parsing of Prosemirror JSON back to the original DokuWiki-Syntax in `_test/jsonParser.test.php`\n1. Testing the validity of the Prosemirror JSON against the schema (`script/schema.js`) in `_jstest/test.js`\n\nThe rendering and parsing tests are run as usual DokuWiki tests.\nThe javascript tests are run with `yarn test`\n\nThe scripts in `script/` are also checked when building with eslint.\nEslint can also be run on its own with `yarn eslint`.\n\n## Copyright\nCopyright (C) CosmoCode GmbH \u003cdokuwiki@cosmocode.de\u003e\n    Andreas Gohr\n    Michael Grosse\n    Anna Dabrowska\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; version 2 of the License\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nSee the COPYING file in your DokuWiki folder for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcosmocode%2Fdokuwiki-plugin-prosemirror","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcosmocode%2Fdokuwiki-plugin-prosemirror","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcosmocode%2Fdokuwiki-plugin-prosemirror/lists"}