Skip to content

Commit

Permalink
add remark-pangu
Browse files Browse the repository at this point in the history
  • Loading branch information
oeyoews committed Dec 23, 2023
1 parent cac1df9 commit 6728a9b
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 7 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
"redux-persist-webextension-storage": "^1.0.2",
"rehype-parse": "^9.0.0",
"rehype-remark": "^10.0.0",
"remark-gfm": "4.0.0",
"remark-pangu": "^2.2.0",
"remark-stringify": "^11.0.0",
"rfdc": "^1.3.0",
"tiny-delay": "^1.0.6",
Expand All @@ -56,7 +58,6 @@
"unist-util-visit": "^5.0.0",
"webext-zustand": "^0.2.0",
"webextension-polyfill": "^0.10.0",
"remark-gfm": "4.0.0",
"zustand": "^4.4.3"
},
"devDependencies": {
Expand Down
36 changes: 36 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/popup/hooks/useTransformFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import { Dispatch, SetStateAction, useEffect, useRef } from 'react';
import rehypeParse from 'rehype-parse';
import rehypeRemark from 'rehype-remark';
import remarkGfm from 'remark-gfm';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
import remarkPangu from 'remark-pangu';
import remarkStringify from 'remark-stringify';
import { unified } from 'unified';

Expand All @@ -20,7 +23,9 @@ const html2mdParser = unified()
.use(rehypeParse)
.use(remarkGfm)
.use(rehypeRemark)
.use(remarkStringify);
.use(remarkStringify)
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
.use(remarkPangu);

export function useTransformFormat(
content: IContent,
Expand Down
12 changes: 7 additions & 5 deletions src/shared/hooks/useAddTiddlerToServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,13 @@ export function pad(number: number) {
return String(number);
}
export function toTWUTCString(date: Date) {
return `${date.getUTCFullYear()}${pad(date.getUTCMonth() + 1)}${pad(
date.getUTCDate(),
)
}${pad(date.getUTCHours())}${pad(date.getUTCMinutes())}${pad(
return `${date.getUTCFullYear()}${pad(date.getUTCMonth() + 1)}${
pad(
date.getUTCDate(),
)
}${pad(date.getUTCHours())}${pad(date.getUTCMinutes())}${
pad(
date.getUTCSeconds(),
)
}${(date.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5)}`;
}${(date.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5)}`;
}

0 comments on commit 6728a9b

Please sign in to comment.