-
Notifications
You must be signed in to change notification settings - Fork 95
DOC-13760 produce markdown per page (WIP) #863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| override: | ||
| ui: | ||
| bundle: | ||
| url: https://github.com/couchbase/docs-ui/releases/download/DOC-13760-markdown-alt-1/ui-bundle.zip |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,78 @@ | ||||||||||||||||||||||||||||||||||
| 'use strict' | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const {convertHtmlToMarkdown} = require('dom-to-semantic-markdown') | ||||||||||||||||||||||||||||||||||
| const {JSDOM} = require('jsdom') | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| function overrideElementProcessing (element) { | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (element.tagName?.toLowerCase() === 'a' | ||||||||||||||||||||||||||||||||||
| && element.className === 'anchor' ) { | ||||||||||||||||||||||||||||||||||
| return [{type: 'custom', blank: true}] | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (element.classList?.contains("admonitionblock")) { | ||||||||||||||||||||||||||||||||||
| element.classList.remove('admonitionblock') | ||||||||||||||||||||||||||||||||||
| const admonition = element.className.toUpperCase() | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+14
to
+15
|
||||||||||||||||||||||||||||||||||
| element.classList.remove('admonitionblock') | |
| const admonition = element.className.toUpperCase() | |
| // Extract admonition type before removing 'admonitionblock' | |
| const admonitionType = Array.from(element.classList).find(cls => cls !== 'admonitionblock') || ''; | |
| element.classList.remove('admonitionblock') | |
| const admonition = admonitionType.toUpperCase() |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The variable name path shadows the outer scope if Node's path module is imported elsewhere. Consider renaming to mdPath or markdownPath to avoid potential confusion.
| const path = page.out.path.replace(/\.html$/, '.md') | |
| // tell docs-ui to output <link rel="alternate" ...> for the markdown page. | |
| page.asciidoc.attributes["page-markdown-alt"] = `${page.out.rootPath}/${path}` | |
| siteCatalog.addFile({ | |
| contents: Buffer.from(markdown), | |
| out: { path } | |
| const mdPath = page.out.path.replace(/\.html$/, '.md') | |
| // tell docs-ui to output <link rel="alternate" ...> for the markdown page. | |
| page.asciidoc.attributes["page-markdown-alt"] = `${page.out.rootPath}/${mdPath}` | |
| siteCatalog.addFile({ | |
| contents: Buffer.from(markdown), | |
| out: { path: mdPath } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition uses
className(string) for comparison, but the admonition check below usesclassList.contains(). UseclassList.contains('anchor')for consistency and to handle multiple classes correctly.