Sfoglia il codice sorgente

delete frontmatter hider

reiji-h 2 anni fa
parent
commit
18c5133169

+ 0 - 1
apps/app/src/features/frontmatter-hider/index.ts

@@ -1 +0,0 @@
-export * from './services';

+ 0 - 35
apps/app/src/features/frontmatter-hider/services/frontmatter-hider.ts

@@ -1,35 +0,0 @@
-
-import type { Schema as SanitizeOption } from 'hast-util-sanitize';
-import { Plugin } from 'unified';
-import { Node } from 'unist';
-import { visit } from 'unist-util-visit';
-
-function rewriteNode(node: Node) {
-  // replace node
-  const data = node.data ?? (node.data = {});
-  data.hName = 'frontmatter';
-}
-
-export const remarkPlugin: Plugin = function() {
-  return (tree) => {
-    visit(tree, (node) => {
-      if (node.type === 'yaml') {
-        rewriteNode(node);
-      }
-    });
-  };
-};
-
-export const rehypePlugin: Plugin = function() {
-  return (tree) => {
-    visit(tree, (node) => {
-      if (node.type === 'yaml') {
-        return;
-      }
-    });
-  };
-};
-
-export const sanitizeOption: SanitizeOption = {
-  tagNames: ['frontmatter'],
-};

+ 0 - 1
apps/app/src/features/frontmatter-hider/services/index.ts

@@ -1 +0,0 @@
-export { remarkPlugin, rehypePlugin, sanitizeOption } from './frontmatter-hider';

+ 0 - 3
apps/app/src/services/renderer/renderer.tsx

@@ -16,7 +16,6 @@ import type { Pluggable, PluginTuple } from 'unified';
 
 import { CodeBlock } from '~/components/ReactMarkdownComponents/CodeBlock';
 import { NextLink } from '~/components/ReactMarkdownComponents/NextLink';
-import * as frontmatterHider from '~/features/frontmatter-hider';
 import { RehypeSanitizeOption } from '~/interfaces/rehype';
 import type { RendererOptions } from '~/interfaces/renderer-options';
 import type { RendererConfig } from '~/interfaces/services/renderer';
@@ -101,7 +100,6 @@ export const generateCommonOptions = (pagePath: string|undefined): RendererOptio
       pukiwikiLikeLinker,
       growiDirective,
       remarkFrontmatter,
-      // frontmatterHider.remarkPlugin,
     ],
     remarkRehypeOptions: {
       clobberPrefix: '', // remove clobber prefix
@@ -114,7 +112,6 @@ export const generateCommonOptions = (pagePath: string|undefined): RendererOptio
       [addClass.rehypePlugin, {
         table: 'table table-bordered',
       }],
-      // frontmatterHider.rehypePlugin,
     ],
     components: {
       a: NextLink,