diff --git a/docs/core_docs/scripts/quarto-build.js b/docs/core_docs/scripts/quarto-build.js index e502be91dd7d..128111f8d095 100644 --- a/docs/core_docs/scripts/quarto-build.js +++ b/docs/core_docs/scripts/quarto-build.js @@ -3,6 +3,7 @@ const { glob } = require("glob"); const { execSync } = require("node:child_process"); const IGNORED_CELL_REGEX = /```\w*?\n\/\/ ?@lc-docs-hide-cell\n[\s\S]*?```/g; +const LC_TS_IGNORE_REGEX = /\/\/ ?@lc-ts-ignore\n/g; async function main() { const allIpynb = await glob("./docs/**/*.ipynb"); @@ -20,8 +21,13 @@ async function main() { for (const renamedFilepath of allRenames) { if (fs.existsSync(renamedFilepath)) { let content = fs.readFileSync(renamedFilepath).toString(); - if (content.match(IGNORED_CELL_REGEX)) { - content = content.replace(IGNORED_CELL_REGEX, ""); + if ( + content.match(IGNORED_CELL_REGEX) || + content.match(LC_TS_IGNORE_REGEX) + ) { + content = content + .replace(IGNORED_CELL_REGEX, "") + .replace(LC_TS_IGNORE_REGEX, ""); fs.writeFileSync(renamedFilepath, content); } } diff --git a/docs/core_docs/scripts/validate_notebook.ts b/docs/core_docs/scripts/validate_notebook.ts index 7afdd366cc4a..fd0c4cba7242 100644 --- a/docs/core_docs/scripts/validate_notebook.ts +++ b/docs/core_docs/scripts/validate_notebook.ts @@ -8,8 +8,11 @@ export function extract(filepath: string) { const sourceFile = project.createSourceFile("temp.ts", ""); cells.forEach((cell: Record) => { + const source = cell.source + .join("") + .replace(/\/\/ ?@lc-ts-ignore/g, "// @ts-ignore"); if (cell.cell_type === "code") { - sourceFile.addStatements(cell.source.join("")); + sourceFile.addStatements(source); } });