From d18160a22215a15e300f33cbc0dd52782a28c58c Mon Sep 17 00:00:00 2001 From: Russ Rutledge Date: Tue, 8 Sep 2026 10:36:10 -0500 Subject: [PATCH] Fix asciidoctor v4 ESM import to unbreak Publish to website 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. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01H1niVBoyczk8mXe9L7Fnzv --- scripts/generate_learning_path_markdown.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/generate_learning_path_markdown.js b/scripts/generate_learning_path_markdown.js index 769f4b2f..55ff6ea9 100644 --- a/scripts/generate_learning_path_markdown.js +++ b/scripts/generate_learning_path_markdown.js @@ -1,8 +1,7 @@ import { join, basename, relative } from 'path' import fs from 'fs' import yamlFront from 'yaml-front-matter' -import asciidoctor from 'asciidoctor' -const Asciidoctor = asciidoctor() +import { convert } from 'asciidoctor' import YAML from 'yaml' import getContributors from './get_contributors.js' @@ -90,7 +89,7 @@ const getArticleImage = (youTubeCode) => { } const titleStripped = article.asciiDoc.replace(/== (.*)/, '') - const body = section.renderArticles || isTranslation ? Asciidoctor.convert(titleStripped) : '' + const body = section.renderArticles || isTranslation ? await convert(titleStripped) : '' writeMarkdownFile(fileName, frontMatter, body) }) @@ -109,7 +108,7 @@ const getArticleImage = (youTubeCode) => { const workbookReadPath = join('..', 'workbook', section.workbook) if (section.workbook && fs.existsSync(workbookReadPath)) { - const body = Asciidoctor.convert(fs.readFileSync(workbookReadPath, 'utf-8')) + const body = await convert(fs.readFileSync(workbookReadPath, 'utf-8')) writeMarkdownFile(workbookFileName, workbookFrontMatter, body) } })