Skip to content

Escaped brackets \[ before adjacent inline Markdown links get corrupted after HTML export → import round-trip #2399

Closed

Description

@Quintilien

Description

When a Docmost page contains a sequence of short adjacent Markdown links wrapped in escaped literal brackets — a common pattern for citation-style references, e.g. generated by an AI assistant — the content renders correctly after initial paste, but becomes corrupted after an HTML export → import round-trip (into a different space, and/or a different Docmost instance).

Exact source Markdown that reproduces the issue

(extracted via Docmost's own Markdown export of the original, still-correct page):

... et qu'**Authentik** agit comme une suite d'identité complète et avancée\. \[[1](https://www.reddit.com/r/selfhosted/comments/1lxodhq/authentik_vs_pocketid_your_opinion_and_experience/?tl=fr), [2](https://www.youtube.com/watch?v=nMHK_rCqDJs&t=31), [3](https://www.youtube.com/watch?v=nm3Oe1TOsaM), [4](https://www.cerbos.dev/blog/authelia-vs-authentik-2026-idp)\]

Note the structure: a literal escaped opening bracket \[, immediately followed by several [n](url) links separated by , , closed by a literal escaped \]. This pattern repeats multiple times in the same document (once per paragraph/bullet), each with its own set of 1–5 links.

Steps to reproduce

  1. Paste the above Markdown snippet into a Docmost page (paste-as-Markdown).
  2. Confirm it renders correctly: literal [ then clickable 1, 2, 3, 4 (each linking to its respective URL), separated by commas, then literal ].
  3. Export the page (or its parent space) as HTML, with attachments, as a ZIP.
  4. Import that ZIP into a different space (same instance, or a different Docmost instance/deployment).
  5. Observe: content following the opening bracket/first link is truncated or the citation sequence is malformed — text after [1, (or similar) is lost, as if a link tag failed to close properly during HTML import parsing and swallowed the remainder of the paragraph.

Control test (works correctly)

A plain link created natively via the Docmost editor's own link tool (not pasted from external Markdown, no adjacent bracket punctuation) survives the identical export → import round-trip without any issue. This isolates the bug specifically to pasted Markdown links immediately adjacent to literal escaped bracket characters — not to the HTML export/import mechanism in general.

Hypothesis

The HTML importer may internally re-serialize/re-parse content through a Markdown-like intermediate step. A literal [ character sitting immediately before an <a> tag could be misinterpreted as the start of a new Markdown link ([[1](url) ambiguity) rather than as literal text, corrupting the surrounding content.

Expected behavior

Literal bracket characters adjacent to links should be preserved as plain text through the export → import round-trip, exactly as they were originally authored.

Environment

  • Docmost version at export time (source): 0.90.1
  • Docmost version at import time (destination): 0.95.0
  • Self-hosted, Docker Compose deployment, both instances
  • Export format: HTML (with attachments), imported into a separate Docmost instance running a newer version

Additional note: the export and import happened across two different Docmost versions (0.90.1 → 0.95.0). It's currently unclear whether this bug is version-independent (a general HTML round-trip parsing issue) or specifically triggered by the version mismatch between export and import. If maintainers can confirm/rule out a same-version round-trip reproduction, that would help narrow down the cause.

Activity

  1. added
    bug
    on Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions