Add blog app scaffolding with remark plugins
This commit is contained in:
parent
9d9f213bbe
commit
0b8b50cf12
5 changed files with 84 additions and 0 deletions
14
apps/blog/src/plugins/remark-aside.ts
Normal file
14
apps/blog/src/plugins/remark-aside.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { visit } from 'unist-util-visit';
|
||||
import type { Root } from 'mdast';
|
||||
|
||||
export default function remarkAside() {
|
||||
return (tree: Root) => {
|
||||
visit(tree, 'textDirective', (node: any) => {
|
||||
if (node.name !== 'aside') return;
|
||||
|
||||
const data = node.data || (node.data = {});
|
||||
data.hName = 'span';
|
||||
data.hProperties = { class: 'aside' };
|
||||
});
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue