ammachado opened a new pull request, #1750:
URL: https://github.com/apache/camel-website/pull/1750

   ## Summary
   
   Fixes #1746. 35 documentation pages had no `.md` mirror because 
`generate-markdown` silently skipped them.
   
   - **Cause:** Asciidoctor emits mis-nested inline tags for some sources (for 
example, a `*` inside backticks becomes 
`<code>core/camel-<strong></code>…</strong>`). `node-html-parser` drops the 
unmatched close tag, and at end of input unwraps every unclosed ancestor, 
including `article.doc`, so the page had no main content and was skipped.
   - **Fix:** pages that `node-html-parser`'s `valid()` rejects are repaired 
with jsdom's HTML5 parser before extraction, the way a browser does. `jsdom` is 
already a direct dependency. `valid()` is `base_parse(html).length === 1`, 
exactly the condition under which `parse()` runs its destructive unwrap, so 
well-formed pages take the unchanged path.
   - **Why not `parseNoneClosedTags: true`** (proposed in the issue): it keeps 
`article.doc`, but the unclosed `<code>` swallows the rest of the article and 
Turndown flattens it into one inline code span. On `security-model` that gave 
125 lines with a 76,012-char line, instead of 597 lines and 37 headings.
   - **Logging:** repaired pages (`Repaired malformed HTML in <file>`) and 
pages without main content are now logged instead of skipped silently, so each 
build names the sources to fix upstream. The source locations are listed in 
#1746.
   
   The per-page conversion moves unchanged into an exported `convertPage()` so 
it can be tested without a `public/` tree.
   
   ## Verification
   
   On a full production Antora build (`yarn build:antora`, 5,432 pages), run 
through the real `yarn build:markdown` task:
   
   | | Before | After |
   |---|---|---|
   | Pages skipped | 35 (the 35 missing in production) | 0 |
   | Pages repaired | n/a | 35, one warning each, same set |
   | Markdown lines over 20,000 chars | n/a | 0 |
   | Added task time | | about 10 s (`valid()` on every page, jsdom on 35) |
   
   ## Test plan
   
   - [x] `yarn test`: 12/12 pass. The 5 new tests in 
`test/generate-markdown-test.js` use the real Asciidoctor output from 
`security-model.adoc` and `camel-jbang-mcp.adoc`.
   - [x] The new regression tests fail on the current code (page skipped) and 
also fail with `parseNoneClosedTags: true` (later heading and list items 
flattened).
   - [x] Full production Antora build plus `yarn build:markdown`: 5,432/5,432 
pages converted.
   
   Note: `yarn build:antora` currently exits 1 because of one upstream warning 
(`skipping reference to missing attribute: myrequiredflag` in 
`camel-4x-upgrade-guide-4_23.adoc`) combined with `failure_level: warn`. This 
change does not cause it.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code) on behalf of 
Adriano Machado (@ammachado)
   
   _This was generated by an AI agent and may contain inaccuracies. Please 
verify before relying on it._
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to