Compare commits
3 Commits
280c69586f
...
66d07bb2a5
Author | SHA1 | Date | |
---|---|---|---|
66d07bb2a5 | |||
28035a8513 | |||
98ff7de56a |
22
.github/workflows/npm-publish.yml
vendored
22
.github/workflows/npm-publish.yml
vendored
@ -15,18 +15,12 @@ jobs:
|
|||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
- run: npm ci
|
registry-url: https://registry.npmjs.org
|
||||||
- run: npm run build
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
publish-npm:
|
- name: Build
|
||||||
needs: build
|
run: npm run build
|
||||||
runs-on: ubuntu-latest
|
- name: Publish package to npm
|
||||||
steps:
|
run: npm publish
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
registry-url: https://registry.npmjs.org/
|
|
||||||
- run: npm publish
|
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hexo-highlighter-shiki",
|
"name": "hexo-highlighter-shiki",
|
||||||
"version": "1.2.0",
|
"version": "1.2.2",
|
||||||
"description": "A package for Hexo which use Shiki to render code highlight.",
|
"description": "A package for Hexo which use Shiki to render code highlight.",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
@ -36,6 +36,7 @@
|
|||||||
"typescript": "^5.6.3"
|
"typescript": "^5.6.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"hexo": "^7.0.0"
|
"hexo": "^7.0.0",
|
||||||
|
"hexo-util": "^3.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,7 @@ export async function init(hexo: Hexo) {
|
|||||||
for (const extra_theme of [].concat(config.additional.themes)) {
|
for (const extra_theme of [].concat(config.additional.themes)) {
|
||||||
additional_themes.push(JSON.parse(readFileSync(extra_theme, "utf8")));
|
additional_themes.push(JSON.parse(readFileSync(extra_theme, "utf8")));
|
||||||
}
|
}
|
||||||
|
// 处理主题
|
||||||
const themes = additional_themes.concat(
|
const themes = additional_themes.concat(
|
||||||
(typeof config.theme === "string" ? [config.theme] : Object.values(config.theme)).filter(
|
(typeof config.theme === "string" ? [config.theme] : Object.values(config.theme)).filter(
|
||||||
(theme) => theme in bundledThemes
|
(theme) => theme in bundledThemes
|
||||||
@ -151,7 +152,7 @@ export async function init(hexo: Hexo) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
if (config.theme === "string")
|
if (typeof config.theme === "string")
|
||||||
pre = highlighter.codeToHtml(code, {
|
pre = highlighter.codeToHtml(code, {
|
||||||
lang,
|
lang,
|
||||||
theme: config.theme,
|
theme: config.theme,
|
||||||
|
Loading…
Reference in New Issue
Block a user