Skip to content
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

Upgrade to TypeScript v5.2 #6476

Merged
merged 17 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/docs-data/compile-docs-data.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import semver from "semver";

import { Classes } from "@blueprintjs/core";

import { markedRenderer } from "./markdownRenderer.mjs";
import { hooks, markedRenderer } from "./markdownRenderer.mjs";

/** Run Documentalist on Sass, TypeScript, and package.json files in these packages */
const LIBRARY_PACKAGES = ["core", "datetime", "datetime2", "icons", "select", "table"];
Expand Down Expand Up @@ -52,7 +52,10 @@ console.info(`[docs-data] successfully generated docs.json`);
*/
async function generateDocumentalistData() {
const documentalist = new Documentalist({
markdown: { renderer: markedRenderer },
markdown: {
renderer: markedRenderer,
hooks,
},
sourceBaseDir: monorepoRootDir,
// must mark our @Decorator APIs as reserved so we can use them in code samples
reservedTags: ["import", "ContextMenuTarget", "HotkeysTarget", "param", "returns"],
Expand Down
11 changes: 10 additions & 1 deletion packages/docs-data/markdownRenderer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,13 @@ function renderMarkdown(textContent) {
return marked(textContent, { renderer });
}

export { renderMarkdown, renderer as markedRenderer };
const hooks = {
// HACKHACK: workaround for https://github.com/palantir/documentalist/issues/248
// We are getting inline code snippets wrapped by newlines, which breaks the markdown rendering of multiline JSDoc
// comments. We can work around this by removing the newlines. This should work for all practical cases since we
// don't expect any JSDoc comment line to simply have a `code` token as its only contents.
preprocess: md => md.replace(/\n(\`.*\`)\n/g, "$1"),
adidahiya marked this conversation as resolved.
Show resolved Hide resolved
postprocess: html => html,
};

export { hooks, renderMarkdown, renderer as markedRenderer };