~bigbes/confluence-md-utilities

ref: 3c0272ac2232ee3a0edd0c259b71e9fd3384f211 confluence-md-utilities/format/pretty_test.go -rw-r--r-- 8.9 KiB
f6c846a1 — Eugene Blikh a month ago
fix: preserve inline spacing in fmt and code-block round-trip

Three related round-trip/formatting bugs, each pinned by a regression test
that fails on the prior code:

- fmt dropped the significant space between two inline elements
  (</strong> <code>): a lone-space text node was always treated as
  indentation. Keep it mid-line; drop it only at a block boundary.
- fmt's line-wrapper dropped a word's trailing space before a tag
  (strings.Fields discards it) and broke inside <code>...</code>,
  injecting indent that xml2md collapses into a spurious in-span space.
  Rewrote wrapLine around an atom model with a per-atom spaceBefore flag
  and keeps an inline code span whole.
- verify.normalizeForVerify's reBareTextAfterHeading used \S for its
  "visible char" token; \S matches '<', so the capture swallowed a
  following <ac:structured-macro> and wrapped it in <p>...</p>, splitting
  a code macro from its body and breaking round-trip for a no-language
  fenced code block after a heading. Use [^\s<] instead.

Full RFC-0010 document now verifies as lossless.
701c5ef2 — Eugene Blikh 2 months ago
feat: improve round-trip fidelity for panels, tables, and verify

- Preserve panel name (info/note/warning), macro-id, parameters, and
  body-bare layout via HTML comment markers so blockquotes round-trip
  back to the original ac:structured-macro form.
- Serialize tables with complex cell content (nested lists, structured
  macros, row-header th, page links) as raw XML inside the markdown so
  GFM table limits don't lossily flatten them.
- Distinguish ac:toc inside <p> from bare ac:toc, restoring the wrapper.
- Strip inline-comment-marker wrappers and decorative <span>s inside
  code spans where markdown can't represent them.
- Normalize self-closing tags to "<tag />" and unify &#34;/&#39; with
  &quot;/' so the pretty printer doesn't introduce cosmetic diffs.
- Apply verify normalization to both input and round-trip output, and
  add rules for trailing whitespace, <br/> before </li>, <p>-wrapped
  image runs, and bare text after headings.
fb67f698 — Eugene Blikh 4 months ago
Initial commit: mdcx — Markdown to Confluence XML converter

Bidirectional converter between Markdown and Confluence storage format XML
with self-hosted Confluence Server/Data Center sync support.

Features:
- convert: Markdown → Confluence XML
- extract: Confluence XML → Markdown
- embed: embed Markdown into Confluence XML template (marker-based)
- pull/push: sync pages with Confluence via REST API + PAT auth
- fmt: pretty-print Confluence XML with sensible indentation
- Round-trip preservation of inline comments, user refs, attachment images

false