Skip to content

Commit

Permalink
fix: fix github-corners option issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Oct 3, 2023
1 parent 5601c62 commit 9ab6287
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 22 deletions.
46 changes: 28 additions & 18 deletions packages/action/dist/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -67211,6 +67211,10 @@ for (var _i3 = 0; _i3 < letters.length; _i3++) {
defineSymbol(katex_text, main, textord, _ch3, wideChar);
wideChar = String.fromCharCode(0xD835, 0xDD04 + _i3); // A-Z a-z Fractur

defineSymbol(math, main, mathord, _ch3, wideChar);
defineSymbol(katex_text, main, textord, _ch3, wideChar);
wideChar = String.fromCharCode(0xD835, 0xDD6C + _i3); // A-Z a-z bold Fractur

defineSymbol(math, main, mathord, _ch3, wideChar);
defineSymbol(katex_text, main, textord, _ch3, wideChar);
wideChar = String.fromCharCode(0xD835, 0xDDA0 + _i3); // A-Z a-z sans-serif
Expand Down Expand Up @@ -67325,10 +67329,11 @@ var wideLatinLetterData = [["mathbf", "textbf", "Main-Bold"],
// A-Z double-struck
["mathbb", "textbb", "AMS-Regular"],
// k double-struck
["", "", ""],
// A-Z bold Fraktur No font metrics
["", "", ""],
// a-z bold Fraktur. No font.
// Note that we are using a bold font, but font metrics for regular Fraktur.
["mathboldfrak", "textboldfrak", "Fraktur-Regular"],
// A-Z bold Fraktur
["mathboldfrak", "textboldfrak", "Fraktur-Regular"],
// a-z bold Fraktur
["mathsf", "textsf", "SansSerif-Regular"],
// A-Z sans-serif
["mathsf", "textsf", "SansSerif-Regular"],
Expand Down Expand Up @@ -67506,12 +67511,16 @@ var makeOrd = function makeOrd(group, options, type) {

var isFont = mode === "math" || mode === "text" && options.font;
var fontOrFamily = isFont ? options.font : options.fontFamily;
var wideFontName = "";
var wideFontClass = "";
if (text.charCodeAt(0) === 0xD835) {
var _wideCharacterFont = wideCharacterFont(text, mode);
var _wideCharacterFont2 = (0,slicedToArray/* default */.Z)(_wideCharacterFont, 2);
wideFontName = _wideCharacterFont2[0];
wideFontClass = _wideCharacterFont2[1];
}
if (wideFontName.length > 0) {
// surrogate pairs get special treatment
var _wideCharacterFont = wideCharacterFont(text, mode),
_wideCharacterFont2 = (0,slicedToArray/* default */.Z)(_wideCharacterFont, 2),
wideFontName = _wideCharacterFont2[0],
wideFontClass = _wideCharacterFont2[1];
return makeSymbol(text, wideFontName, mode, options, classes.concat(wideFontClass));
} else if (fontOrFamily) {
var fontName;
Expand Down Expand Up @@ -79092,7 +79101,7 @@ var katex = {
/**
* Current KaTeX version
*/
version: "0.16.8",
version: "0.16.9",
/**
* Renders the given LaTeX into an HTML+MathML combination, and adds
* it as a child to the specified DOM node.
Expand Down Expand Up @@ -119468,7 +119477,7 @@ function lib_markdown() {
_options$katexOptions = options.katexOptions,
katexOptions = _options$katexOptions === void 0 ? {} : _options$katexOptions;
var remarkPlugins = [remarkGfm].concat((0,toConsumableArray/* default */.Z)(options.remarkPlugins || []));
var rehypePlugins = [rehype_video_lib, [f, {
var rehypePlugins = [rehypeRaw, rehype_video_lib, [f, {
ignoreMissing: true,
showLineNumbers: showLineNumbers
}], [lib, {
Expand Down Expand Up @@ -119509,7 +119518,7 @@ function lib_markdown() {
options.rewrite(node, index, parent);
}
}
}], rehypeRaw, [rehypeKatex, katexOptions], rehypeStringify]);
}], [rehypeKatex, katexOptions], rehypeStringify]);
var processor = unified().use(remarkParse).use(filterPlugins && typeof filterPlugins === 'function' ? filterPlugins('remark', remarkPlugins) : remarkPlugins).use(remarkRehype, Object.assign(Object.assign({}, options.remarkRehypeOptions), {
allowDangerousHtml: true
})).use(filterPlugins && typeof filterPlugins === 'function' ? filterPlugins('rehype', rehypePlugins) : rehypePlugins);
Expand Down Expand Up @@ -138900,14 +138909,15 @@ function lib_create_create() {


function utils_formatConfig(opts) {
var options = _objectSpread2(_objectSpread2({}, opts), {}, {
document: {
var options = _objectSpread2({}, opts);
if (!options.document) {
options.document = {
title: opts.title,
meta: [],
link: [],
style: []
}
});
};
}
var projectPkg = external_path_.resolve(process.cwd(), opts.config || 'package.json');
var pgkData = {};
if (fs_extra_lib.existsSync(projectPkg)) {
Expand All @@ -138916,7 +138926,7 @@ function utils_formatConfig(opts) {
options.document.title = pgkData.name;
}
if (pgkData.repository && !opts['github-corners']) {
opts['github-corners'] = typeof pgkData.repository === 'string' ? pgkData.repository : pgkData.repository.url;
options['github-corners'] = typeof pgkData.repository === 'string' ? pgkData.repository : pgkData.repository.url;
}
if (pgkData['markdown-to-html']) {
var mth = pgkData['markdown-to-html'];
Expand All @@ -138932,12 +138942,12 @@ function utils_formatConfig(opts) {
}, mth.document)
});
if (mth['github-corners']) {
opts['github-corners'] = mth['github-corners'];
options['github-corners'] = mth['github-corners'];
}
}
}
if (opts['github-corners'] && typeof opts['github-corners'] === 'string') {
opts['github-corners'] = opts['github-corners'].replace(/^git[+]/, '');
options['github-corners'] = opts['github-corners'].replace(/^git[+]/, '');
}
if (Array.isArray(options.document.link) && options.favicon) {
options.document.link.push({
Expand Down
11 changes: 7 additions & 4 deletions packages/cli/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { type RunArgvs, type MDToHTMLOptions } from './index.js';
export type Options = Omit<RunArgvs, '_'>

export function formatConfig(opts: Options) {
let options = { ...opts, document: { title: opts.title, meta: [], link: [], style: [] } } as MDToHTMLOptions;
let options = { ...opts } as MDToHTMLOptions;
if (!options.document) {
options.document = { title: opts.title, meta: [], link: [], style: [] }
}
const projectPkg = path.resolve(process.cwd(), opts.config || 'package.json');
let pgkData: any = {};
if (fs.existsSync(projectPkg)) {
Expand All @@ -14,19 +17,19 @@ export function formatConfig(opts: Options) {
options.document.title = pgkData.name;
}
if (pgkData.repository && !opts['github-corners']) {
opts['github-corners'] = typeof pgkData.repository === 'string' ? pgkData.repository : pgkData.repository.url;
options['github-corners'] = typeof pgkData.repository === 'string' ? pgkData.repository : pgkData.repository.url;
}
if (pgkData['markdown-to-html']) {
const mth = pgkData['markdown-to-html'] as MDToHTMLOptions;
const { title, meta, link } = options.document;
options = { ...options, ...mth, document: { title, meta, link, ...mth.document } }
if (mth['github-corners']) {
opts['github-corners'] = mth['github-corners'];
options['github-corners'] = mth['github-corners'];
}
}
}
if (opts['github-corners'] && typeof opts['github-corners'] === 'string') {
opts['github-corners'] = opts['github-corners'].replace(/^git[+]/, '')
options['github-corners'] = opts['github-corners'].replace(/^git[+]/, '')
}
if (Array.isArray(options.document.link) && options.favicon) {
options.document.link.push({ rel: 'icon', href: options.favicon, type: 'image/x-icon' });
Expand Down

0 comments on commit 9ab6287

Please sign in to comment.