fix(marked): compatibility with marked 4
This commit is contained in:
@@ -80,12 +80,12 @@ var fs_1 = require("fs");
|
|||||||
var path = __importStar(require("path"));
|
var path = __importStar(require("path"));
|
||||||
var front_matter_1 = __importDefault(require("front-matter"));
|
var front_matter_1 = __importDefault(require("front-matter"));
|
||||||
// @ts-ignore esModuleInterop is activated in tsconfig.scripts.json, but IDE typescript uses default typescript config
|
// @ts-ignore esModuleInterop is activated in tsconfig.scripts.json, but IDE typescript uses default typescript config
|
||||||
var marked_1 = __importDefault(require("marked"));
|
var marked_1 = require("marked");
|
||||||
var highlight_js_1 = __importDefault(require("highlight.js"));
|
var highlight_js_1 = __importDefault(require("highlight.js"));
|
||||||
var file_1 = require("./file");
|
var file_1 = require("./file");
|
||||||
var model_1 = require("../../src/model");
|
var model_1 = require("../../src/model");
|
||||||
var paths_1 = require("../paths");
|
var paths_1 = require("../paths");
|
||||||
marked_1.default.setOptions({
|
marked_1.marked.setOptions({
|
||||||
highlight: function (code) { return highlight_js_1.default.highlightAuto(code).value; },
|
highlight: function (code) { return highlight_js_1.default.highlightAuto(code).value; },
|
||||||
});
|
});
|
||||||
var createRadar = function () { return __awaiter(void 0, void 0, void 0, function () {
|
var createRadar = function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||||
@@ -133,7 +133,7 @@ var createRevisionsFromFiles = function (fileNames) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fm = front_matter_1.default(data);
|
fm = front_matter_1.default(data);
|
||||||
html = marked_1.default(fm.body.replace(/\]\(\//g, "](" + publicUrl + "/"));
|
html = marked_1.marked(fm.body.replace(/\]\(\//g, "](" + publicUrl + "/"));
|
||||||
html = html.replace(/a href="http/g, 'a target="_blank" rel="noopener noreferrer" href="http');
|
html = html.replace(/a href="http/g, 'a target="_blank" rel="noopener noreferrer" href="http');
|
||||||
resolve(__assign(__assign(__assign({}, itemInfoFromFilename(fileName)), checkAttributes(fileName, fm.attributes)), { fileName: fileName, body: html }));
|
resolve(__assign(__assign(__assign({}, itemInfoFromFilename(fileName)), checkAttributes(fileName, fm.attributes)), { fileName: fileName, body: html }));
|
||||||
}
|
}
|
||||||
@@ -221,5 +221,5 @@ var getItemFlag = function (item, allReleases) {
|
|||||||
if (hasItemChanged(item, allReleases)) {
|
if (hasItemChanged(item, allReleases)) {
|
||||||
return model_1.FlagType.changed;
|
return model_1.FlagType.changed;
|
||||||
}
|
}
|
||||||
return model_1.FlagType.changed;
|
return model_1.FlagType.default;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
exports.getFirstLetter = exports.groupByFirstLetter = exports.groupByQuadrants = exports.nonFeaturedOnly = exports.featuredOnly = exports.FlagType = exports.HomepageOption = void 0;
|
exports.getFirstLetter = exports.groupByFirstLetter = exports.groupByQuadrants = exports.nonFeaturedOnly = exports.featuredOnly = exports.FlagType = exports.HomepageOption = void 0;
|
||||||
var HomepageOption;
|
var HomepageOption;
|
||||||
(function (HomepageOption) {
|
(function (HomepageOption) {
|
||||||
HomepageOption[HomepageOption["chart"] = 0] = "chart";
|
HomepageOption["chart"] = "chart";
|
||||||
HomepageOption[HomepageOption["columns"] = 1] = "columns";
|
HomepageOption["columns"] = "columns";
|
||||||
HomepageOption[HomepageOption["both"] = 2] = "both";
|
HomepageOption["both"] = "both";
|
||||||
})(HomepageOption = exports.HomepageOption || (exports.HomepageOption = {}));
|
})(HomepageOption = exports.HomepageOption || (exports.HomepageOption = {}));
|
||||||
var FlagType;
|
var FlagType;
|
||||||
(function (FlagType) {
|
(function (FlagType) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { readFileSync } from "fs";
|
|||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
import frontMatter from "front-matter";
|
import frontMatter from "front-matter";
|
||||||
// @ts-ignore esModuleInterop is activated in tsconfig.scripts.json, but IDE typescript uses default typescript config
|
// @ts-ignore esModuleInterop is activated in tsconfig.scripts.json, but IDE typescript uses default typescript config
|
||||||
import marked from "marked";
|
import { marked } from "marked";
|
||||||
import highlight from "highlight.js";
|
import highlight from "highlight.js";
|
||||||
|
|
||||||
import { radarPath, getAllMarkdownFiles } from "./file";
|
import { radarPath, getAllMarkdownFiles } from "./file";
|
||||||
@@ -13,7 +13,7 @@ import { appBuild } from "../paths";
|
|||||||
type FMAttributes = ItemAttributes;
|
type FMAttributes = ItemAttributes;
|
||||||
|
|
||||||
marked.setOptions({
|
marked.setOptions({
|
||||||
highlight: (code) => highlight.highlightAuto(code).value,
|
highlight: (code: any) => highlight.highlightAuto(code).value,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const createRadar = async (): Promise<Radar> => {
|
export const createRadar = async (): Promise<Radar> => {
|
||||||
|
|||||||
Reference in New Issue
Block a user