Skip to content

[Bug]: markdown_to_jira (Server/DC wiki path) leaves bare curly braces unescaped and breaks inline code containing braces #1548

Description

@dkodr

Environment

  • mcp-atlassian 0.23.0 (uvx, PyPI)
  • Jira Server 9.4.1 (self-hosted, wiki markup path — not Cloud/ADF)

Summary

On the Server/DC path, JiraPreprocessor.markdown_to_jira produces wiki markup that the
Atlassian wiki renderer mangles whenever the input contains curly braces. Two distinct cases:

1. Bare braces in plain text are passed through unescaped.
The wiki renderer treats any bare {...} as a macro attempt and splits the paragraph.

Input (Markdown): Filter {a: 1} and JSON {"key": "val"} in text
Converter output: unchanged (no escaping)
Rendered HTML (Jira 9.4.1, atlassian-wiki-renderer):
<p>Filter </p> {a: 1} <p> and JSON </p> {"key": "val"} <p> in text</p> — paragraph broken.
Worse with macro-like names: Use {code} or {color:red} here injects an empty code panel
and swallows text.

2. Inline code containing braces is wrapped into invalid nested braces.
Input: Selector `{"id": "default"}`
Converter output: Selector {{{"id": "default"}}}
Rendered: <p>Selector {{</p> {"id": "default"} <p>}}</p> — the parser reads the inner
{...} as a (broken) macro and explodes the fragment. This is the wiki-path counterpart
of #1340 (which covers the Cloud/ADF converter).

Expected behavior

Both render as literal text / monospace. Verified working forms on Jira Server 9.4.1:

  • plain text: backslash escapes — Filter \{a: 1\} renders as Filter {a: 1} (clean <p>)
  • inline code: HTML entities inside monospace — {{&#123;"id": "default"&#125;}} renders
    as full <tt>{"id": "default"}</tt>

Suggested fix

In markdown_to_jira (wiki path only; ADF path unaffected):

  1. after extracting fenced/inline code blocks, escape remaining bare { / } as \{ / \}
    (analogous to the intraword-underscore escaping added in fix(jira): don't italicize intraword underscores in markdown_to_jira #1361),
  2. for inline code spans, emit &#123; / &#125; for braces inside the {{...}} wrapper
    instead of raw braces.

One design consideration: some users may intentionally pass raw Jira macros ({code},
{panel}) through Markdown input — escaping should whitelist balanced known macros or be
opt-out.

I can share full render-endpoint evidence (POST /rest/api/1.0/render) for all cases if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions