forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: ts config * chore: esm format script * chore: bring back ast based formatting * chore: revert 7b0493f * chore: update dependabot config * docs: rename to mdx extension * fix: unused import * docs: fix search build * chore: remove deps changes
- Loading branch information
Showing
52 changed files
with
389 additions
and
481 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import file from './file.mjs'; | ||
import width from 'string-width'; | ||
import { remark } from 'remark'; | ||
import pangu from 'remark-pangu'; | ||
import frontmatter from 'remark-frontmatter'; | ||
import remarkDirective from 'remark-directive'; | ||
import stringify from 'remark-stringify'; | ||
import gfm from 'remark-gfm'; | ||
import prettier from 'remark-preset-prettier'; | ||
import remarkMdx from 'remark-mdx'; | ||
|
||
export default { | ||
rules: (list) => list.filter((e) => e.lang === file.LANG_EN), | ||
handler: async (doc) => { | ||
const result = await remark() | ||
.use(remarkMdx) | ||
.use(frontmatter) | ||
.use(remarkDirective) | ||
.use(pangu, { | ||
inlineCode: false, | ||
link: false, | ||
}) | ||
.use(stringify, { | ||
bullet: '-', | ||
ruleSpaces: true, | ||
}) | ||
.use(prettier) | ||
.use(gfm, { | ||
stringLength: width, | ||
}) | ||
.process(doc); | ||
return String(result); | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import fs from 'fs/promises'; | ||
|
||
export default { | ||
ROUTE_TYPE: 'route', | ||
GUIDE_TYPE: 'guide', | ||
NAV_TYPE: 'nav', | ||
LANG_CN: 'zh-CN', | ||
LANG_EN: 'en-US', | ||
readFile: async (filePath) => await fs.readFile(filePath, { encoding: 'utf8' }), | ||
writeFile: async (filePath, data) => await fs.writeFile(filePath, data, { encoding: 'utf8' }), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export default { | ||
rules: (list) => list.filter((e) => e), | ||
handler: async (data) => { | ||
const content = data.split('\n'); | ||
let lastH2 = ''; | ||
let lastH3 = ''; | ||
|
||
for (let i = 0; i < content.length; i++) { | ||
if (content[i].startsWith('## ')) { | ||
lastH2 = content[i].match(`## (([^{])*)`)?.[1].trim(); | ||
|
||
content[i] = `## ${lastH2}`; | ||
} else if (content[i].startsWith('### ')) { | ||
lastH3 = content[i].match(`### (([^{])*)`)?.[1].trim(); | ||
|
||
content[i] = `### ${lastH3}`; | ||
} else if (content[i].startsWith('#### ')) { | ||
const title = content[i].match(`#### (([^{])*)`)?.[1].trim(); | ||
|
||
content[i] = `#### ${title}`; | ||
} | ||
} | ||
|
||
return Promise.resolve(content.join('\n')); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
website/docs/.format/sortByHeading.js → website/docs/.format/sortByHeading.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.