Skip to content

Commit f83e613

Browse files
rrrutledgeclaude
andauthored
Fix asciidoctor v4 ESM import to unbreak Publish to website (#640)
asciidoctor 4.x removed the default export and the factory-function API: the old `import asciidoctor from 'asciidoctor'` + `asciidoctor().convert()` now throws "does not provide an export named 'default'" at module load, so every Publish to website run has failed since the v4 bump landed. Switch to the v4 named `convert` export and await its two call sites (both already inside async callbacks). v4's convert produces byte-for-byte identical HTML to v3 on the learning-path articles, so published output is unchanged. Claude-Session: https://claude.ai/code/session_01H1niVBoyczk8mXe9L7Fnzv Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent f310d49 commit f83e613

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

scripts/generate_learning_path_markdown.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { join, basename, relative } from 'path'
22
import fs from 'fs'
33
import yamlFront from 'yaml-front-matter'
4-
import asciidoctor from 'asciidoctor'
5-
const Asciidoctor = asciidoctor()
4+
import { convert } from 'asciidoctor'
65
import YAML from 'yaml'
76

87
import getContributors from './get_contributors.js'
@@ -90,7 +89,7 @@ const getArticleImage = (youTubeCode) => {
9089
}
9190

9291
const titleStripped = article.asciiDoc.replace(/== (.*)/, '')
93-
const body = section.renderArticles || isTranslation ? Asciidoctor.convert(titleStripped) : ''
92+
const body = section.renderArticles || isTranslation ? await convert(titleStripped) : ''
9493

9594
writeMarkdownFile(fileName, frontMatter, body)
9695
})
@@ -109,7 +108,7 @@ const getArticleImage = (youTubeCode) => {
109108
const workbookReadPath = join('..', 'workbook', section.workbook)
110109

111110
if (section.workbook && fs.existsSync(workbookReadPath)) {
112-
const body = Asciidoctor.convert(fs.readFileSync(workbookReadPath, 'utf-8'))
111+
const body = await convert(fs.readFileSync(workbookReadPath, 'utf-8'))
113112
writeMarkdownFile(workbookFileName, workbookFrontMatter, body)
114113
}
115114
})

0 commit comments

Comments
 (0)