Skip to content

fix(client): route createPage/createChildPage html through htmlToConfluenceStorage#183

Merged
pchuri merged 1 commit into
mainfrom
fix/create-page-html-normalize
May 12, 2026
Merged

fix(client): route createPage/createChildPage html through htmlToConfluenceStorage#183
pchuri merged 1 commit into
mainfrom
fix/create-page-html-normalize

Conversation

@pchuri
Copy link
Copy Markdown
Owner

@pchuri pchuri commented May 12, 2026

Summary

createComment and updatePage already normalize HTML input via htmlToConfluenceStorage, but createPage and createChildPage were passing HTML straight to storage. Confluence storage is strict XHTML, so inputs with <br>, <u>, or unclosed tags would 422 on the server. Follow-up to #180, which fixed the analogous gap in the convert command.

Result: a page created with --format html and then updated with the same content no longer mutates between the two calls.

Behavior change

Calling createPage/createChildPage with format='html' previously inserted the HTML byte-for-byte. The converter now runs on it, so callers feeding pre-formed storage XHTML will see normalization:

Input Output
<ri:user ri:account-id="…"/> <ri:user ri:account-id="…"></ri:user> (self-closing expanded)
<ul><li>a</li></ul> <ul><li><p>a</p></li></ul> (<p> wrap)
<div class="raw">stuff</div> wrapped in an ac:structured-macro ac:name="html" block

updatePage already does all of this — so the change just removes a divergence between create and update, not introduces a new transform. The removed // (no macro wrapper) comment marked the previous deliberate bypass; we're dropping it on purpose.

Test plan

  • npm test — 678/678 pass (added 2 regression tests for the html paths in createPage / createChildPage)
  • npm run lint — clean
  • Manual edge-case check on the converter: <br>, <u>, <sub>, <img>, empty/whitespace, ac:structured-macro, <ul>/<li>, <table>, <div> — confirmed the transforms above

…luenceStorage

createComment and updatePage already normalize HTML input via
htmlToConfluenceStorage, but createPage and createChildPage were passing
HTML straight to storage. Confluence storage is strict XHTML, so inputs
with <br>, <u>, or unclosed tags would be rejected by the server.

Bring both create paths in line with the rest of the API surface. The
converter is idempotent for storage-quality XHTML (ac:* macros, ri:*
references pass through unchanged), so existing callers feeding
pre-formed storage via format='html' keep working.
@pchuri pchuri self-assigned this May 12, 2026
@pchuri pchuri merged commit 6946cd7 into main May 12, 2026
6 checks passed
@pchuri pchuri deleted the fix/create-page-html-normalize branch May 12, 2026 12:40
github-actions Bot pushed a commit that referenced this pull request May 12, 2026
## [2.6.2](v2.6.1...v2.6.2) (2026-05-12)

### Bug Fixes

* **client:** route createPage/createChildPage html through htmlToConfluenceStorage ([#183](#183)) ([6946cd7](6946cd7))
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 2.6.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant