This issue has been created
There are 2 updates.
 
 
Markdown Syntax / cid:jira-generated-image-avatar-999a73ac-a133-42b2-95ae-83553f4b49fd MARKDOWN-138 Open

Represent code macros, verbatim and monospace with distinct syntaxes in CommonMark Markdown 1.2

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-ed1bfc1f-8547-47b0-a500-252bf94930b4 Vincent Massol created this issue on 31/Oct/26 00:38
 
Summary: Represent code macros, verbatim and monospace with distinct syntaxes in CommonMark Markdown 1.2
Issue Type: cid:jira-generated-image-avatar-999a73ac-a133-42b2-95ae-83553f4b49fd Improvement
Assignee: Unassigned
Components: markdown/1.2
Created: 31/Oct/26 00:38
Priority: cid:jira-generated-image-static-major-1d13e4a4-a9ba-45c0-94c8-4db3f7820f2e Major
Reporter: Vincent Massol
Description:

The code macro, verbatim and monospace are all rendered as Markdown code spans or code blocks, and the Markdown parser reads code spans and code blocks back as code macros. Thus verbatim and monospace content becomes a code macro after a round trip (and the formatting located inside monospace is lost), and a code macro without language gets a language="none" parameter.

The idea is to use a distinct Markdown syntax (raw HTML being allowed in CommonMark) for each of them, so that they can be rendered to Markdown and parsed back without loss:

XWiki markdown/1.2 Parsed back as
Inline code macro with language="none" code span (backticks) inline code macro with language="none" (unchanged)
Standalone code macro with a language fenced code block, the info string being the language (no info string for none) standalone code macro (unchanged)
Code macro without language, or with parameters that a code span or code block can't express XWiki macro syntax:
{{code ...}}...{{/code}}
code macro
Monospace
##x##
<code>x</code>

(the Markdown located inside is parsed, so formatting is kept)

monospace format
Standalone verbatim
<pre>...</pre>

(with < and & written as HTML entities)

standalone verbatim
Inline verbatim
<tt>...</tt>

(with the Markdown and HTML special characters escaped)

inline verbatim

Notes:

  • A code span or a fenced code block without info string keeps being read as a code macro with language="none", since Markdown content isn't highlighted unless a language is specified (see MARKDOWN-65).
  • Only <code>, <tt> and <pre> without attributes would be recognized, the other HTML keeps being read as HTML macros. Hand written <code>, <tt> and <pre> located in existing Markdown pages would be read as monospace and verbatim instead of HTML macros (which renders almost the same).
  • Mapping <code> to monospace is aligned with XRENDERING-780. Using a code macro for Markdown code is a temporary solution until XRENDERING-266 is implemented.

Forum proposal: (link to be added)

 
 

2 updates

 
cid:jira-generated-image-avatar-ed1bfc1f-8547-47b0-a500-252bf94930b4 Changes by Vincent Massol on 31/Oct/26 00:38
 
Version: 8.9.1
Assignee: Vincent Massol