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

tools: fix highlight.js and without-intl compatibility #41086

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 15 additions & 1 deletion tools/doc/html.mjs
Expand Up @@ -22,7 +22,14 @@
import fs from 'fs';
import path from 'path';

import highlightJs from 'highlight.js';
import highlightJs from 'highlight.js/lib/core';
Trott marked this conversation as resolved.
Show resolved Hide resolved
import c from 'highlight.js/lib/languages/c';
import coffeescript from 'highlight.js/lib/languages/coffeescript';
Trott marked this conversation as resolved.
Show resolved Hide resolved
import cpp from 'highlight.js/lib/languages/cpp';
import http from 'highlight.js/lib/languages/http';
import javascript from 'highlight.js/lib/languages/javascript';
import json from 'highlight.js/lib/languages/json';

import raw from 'rehype-raw';
import htmlStringify from 'rehype-stringify';
import gfm from 'remark-gfm';
Expand All @@ -34,6 +41,13 @@ import { visit } from 'unist-util-visit';
import * as common from './common.mjs';
import * as typeParser from './type-parser.mjs';

highlightJs.registerLanguage('js', javascript);
highlightJs.registerLanguage('c', c);
highlightJs.registerLanguage('coffee', coffeescript);
highlightJs.registerLanguage('cpp', cpp);
highlightJs.registerLanguage('http', http);
highlightJs.registerLanguage('json', json);
richardlau marked this conversation as resolved.
Show resolved Hide resolved

const { highlight, getLanguage } = highlightJs;

const docPath = new URL('../../doc/', import.meta.url);
Expand Down