How to use the default function from highlight.js

Find comprehensive JavaScript highlight.js.default code examples handpicked from public code repositorys.

91
92
93
94
95
96
97
98
99
100
var model_1 = require("../../src/model");
var paths_1 = require("../paths");
var file_1 = require("./file");
var config_1 = require("../../src/config");
marked_1.marked.setOptions({
    highlight: function (code) { return highlight_js_1.default.highlightAuto(code).value; },
});
var createRadar = function () { return __awaiter(void 0, void 0, void 0, function () {
    var fileNames, revisions, filterdRevisions, allReleases, items, flaggedItems;
    return __generator(this, function (_a) {
fork icon68
star icon127
watch icon25

+ 2 other calls in file

212
213
214
215
216
217
218
219
220
221
};
function Index2() {
  let dataTitle = (0, import_react4.useLoaderData)();
  const body = import_marked.marked.parse(`${dataTitle.base_post_en[0].body}`);
  (0, import_react5.useEffect)(() => {
    import_highlight.default.initHighlighting();
  }, []);
  return /* @__PURE__ */ React.createElement("div", {
    className: "flex justify-center items-center"
  }, /* @__PURE__ */ React.createElement("div", {
fork icon0
star icon0
watch icon1

86
87
88
89
90
91
92
93
94
95
// and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
quotes: `“”‘’`,
// 必须返回pre标签,否则内部会进行额外包裹
highlight: function (str, lang) {
    let language;
    if (lang && (language = highlight_js_1.default.getLanguage(lang))) {
        try {
            return `<pre class="language-${lang}" data-lang="${language.name}"><code>${highlight_js_1.default.highlight(lang, str, true).value}</code></pre>`;
        }
        catch (_) {
fork icon0
star icon0
watch icon1