feat(wiki): CodeMirror editor for wiki pages (replace EasyMDE) #665
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Replace the current EasyMDE-based wiki editor with the same CodeMirror 6 editor used in the repository code editor. This brings syntax highlighting, VS Code keybindings, command palette, and a modern editing experience to wiki pages.
Current State
templates/repo/wiki/new.tmpl) usescombomarkdowneditortemplate which initializes EasyMDE — a basic markdown toolbar editorweb_src/js/features/repo-editor.ts) usescreateCodeEditor()fromweb_src/js/modules/codeeditor/main.tswhich loads CodeMirror 6 with full language support, indentation markers, linting, and command paletteProposed Changes
Frontend
web_src/js/features/wiki-editor.tswrappingcreateCodeEditor()with wiki-specific extensions:[[triggers a page name picker from the wiki page listtemplates/repo/wiki/new.tmpl— replacecombomarkdowneditorinclude with CodeMirror container + write/preview/diff tabsBackend
routers/web/repo/wiki.gorenderEditPage()needs to passCodeEditorConfigdata (indentation, tab width) to the template, same pattern asrouters/web/repo/editor.go[[autocomplete):GET /:owner/:repo/wiki/-/autocompletereturning page names as JSONKey Files
templates/repo/wiki/new.tmplcombomarkdowneditorwith CodeMirror containerweb_src/js/features/repo-wiki.tsweb_src/js/features/wiki-editor.tsrouters/web/repo/wiki.goWikipedia Parity
This brings the wiki editor to parity with the code editor, matching Wikipedia's VisualEditor/source editor experience with a proper syntax-aware editing environment.
Related