Repository navigation
Conversation
Two commands for the HTML fields, without storing Markdown: - Paste Markdown (command menu): paste Markdown, preview it, insert the converted HTML (tables, code and quotes get inline styles, task lists become Odoo checklists). - To Markdown (command menu for the whole field, toolbar button for the selection): the content as Markdown, to copy it or to replace the content after editing it, with a warning when formatting would be lost. The conversions run in the browser with markdown-it 15.0.3 and Turndown 7.2.5 (MIT), shipped in static/lib, plus GFM rules written in the module. Assisted-by: Claude Code:claude-opus-4-5 Assisted-by: Claude Code:claude-opus-5-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Module
web_editor_paste_markdown (Markdown ↔ HTML): two commands for HTML fields; nothing
is stored as Markdown, the field keeps its HTML.
/menu): a dialog to paste Markdown, with the HTMLpreview; the converted HTML is inserted with inline styles for tables, code and quotes
(they render the same in the editor and in e-mails). Task lists become Odoo
checklists.
selection: the same dialog filled with the content converted to Markdown. Copy it to
use it outside Odoo (image paths made absolute, embedded images replaced by their
text), or edit it and replace the content in one undo step; a warning lists what
Markdown cannot express (colors, styles, merged cells) before replacing.
Proposed as Alpha. No dependency besides
web_editor.It was first part of #3817, next to
web_widget_markdown_editor, whose Toast UI copy itused. It now ships its own, lighter libraries, so the two modules are proposed
separately.
Origin and third-party code
production since then. No code comes from other Odoo modules.
static/libholds, unchanged from their npm packages (source maps removed):(c) Vitaly Puzrin, Alex Kocharin, MIT license;
Christie, MIT license.
task lists, compact list markers, code blocks of the Odoo editor) and the task-list
rule for markdown-it are written in the module;
turndown-plugin-gfmis not used (norelease since 2018, it leaves tables without
thas HTML).editor, sanitizes it; otherwise it is inserted as text.
AI assistance
Following the OCA AI policy, the commit carries an
Assisted-by:trailer: Claude Code(Claude Opus 4.5) for the first Paste Markdown command in December 2025, Claude Code
(Claude Opus 5.5) for To Markdown, the move to markdown-it and Turndown, the tests and
the OCA packaging. I reviewed and tested this code, and I take responsibility for every
line.
Tests
QUnit suite run by
tests/test_js.py(HttpCase.browser_js), 109 assertions:Markdown to HTML (headings, tables, code, task lists, raw HTML with and without
DOMPurify, fallback without the library), HTML to Markdown (tables with and without
header cells, escaped pipes, strikethrough, checklists, nested and numbered lists, code
blocks and their language, literal
~~, tags and entities, round trips), selectionhandling, lost-formatting detection, copy preparation, and the dialog (copy, replace,
warning, close).