Skip to content

Commit

Permalink
type: fix type error.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Sep 28, 2023
1 parent e796e40 commit e02278f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
"doc": "node lib/idoc.js",
"watch": "tsbb watch",
"build": "tsbb build",
"test": "tsbb test",
"coverage": "tsbb test --coverage --bail",
"prettier": "prettier --write --ignore-unknown \"**/*.{js,ts,css,json}\"",
"type-check": "tsc --noEmit",
"prepare": "husky install"
Expand All @@ -44,6 +46,24 @@
"engines": {
"node": ">=16.0.0"
},
"jest": {
"extensionsToTreatAsEsm": [
".ts"
],
"moduleNameMapper": {
"^(\\.{1,2}/.*)\\.js$": "$1"
},
"collectCoverageFrom": [
"<rootDir>/packages/cli/**/*.{tsx,ts}"
],
"coverageReporters": [
"lcov",
"json-summary"
],
"transformIgnorePatterns": [
"<rootDir>/node_modules/?!(.*)"
]
},
"dependencies": {
"@types/ejs": "^3.1.0",
"@types/fs-extra": "~11.0.0",
Expand All @@ -65,6 +85,7 @@
"rehype-format": "^5.0.0",
"rehype-ignore": "~2.0.0",
"rehype-minify-whitespace": "^6.0.0",
"rehype-parse": "^9.0.0",
"rehype-slug": "~6.0.0",
"yaml": "^2.0.0"
},
Expand Down
4 changes: 2 additions & 2 deletions src/markdown/codePreview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ export const codePreview: Plugin<[CodePreviewOptions?], Root> = (options = {}) =
children: [],
});
}
if (node.type === 'element' && node.tagName === 'code' && node.data && node.data.meta) {
const metaRaw = node.data.meta as string;
const metaRaw = (node.data as any)?.meta as string;
if (node.type === 'element' && node.tagName === 'code' && metaRaw) {
const metaData = getCodeMeta(metaRaw);
node.properties['data-meta'] = Object.keys(metaData)
.filter((key: keyof typeof metaData) => metaData[key])
Expand Down

0 comments on commit e02278f

Please sign in to comment.