Skip to content

Commit

Permalink
Replace kleur with picocolors in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed May 8, 2024
1 parent 1823d1f commit cca7a24
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@types/unist": "3.0.2",
"astro": "4.7.1",
"hastscript": "9.0.0",
"kleur": "4.1.5",
"picocolors": "^1.0.0",
"remark-cli": "12.0.1",
"remark-directive": "3.0.0",
"remark-frontmatter": "5.0.0",
Expand Down
5 changes: 3 additions & 2 deletions packages/docs/remark/fixInternalLinks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { bold, cyan, dim } from 'kleur/colors';
import pc from 'picocolors';
import type { Node, Parent } from 'unist';
import { type Visitor, visit } from 'unist-util-visit';

Expand All @@ -13,14 +13,15 @@ const dateTimeFormat = new Intl.DateTimeFormat([], {
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false,
});

export const fixInternalLinks = () => (tree: Parent) => {
const visitor: Visitor = node => {
if (isLinkNode(node) && node.url.startsWith('.')) {
const url = node.url;
node.url = url.replace(/\.mdx?(#.+)?$/, '$1');
console.log(`${dim(dateTimeFormat.format(new Date()))} ${bold(cyan('[fix-link]'))} Modify ${url}${node.url}`);
console.log(`${pc.dim(dateTimeFormat.format(new Date()))} ${pc.cyan('[fix-link]')} Modify ${url}${node.url}`);
}
};
visit(tree, visitor);
Expand Down

0 comments on commit cca7a24

Please sign in to comment.