|
|
@@ -10,6 +10,8 @@ import sanitize from 'rehype-sanitize';
|
|
|
import slug from 'rehype-slug';
|
|
|
import type { HtmlElementNode } from 'rehype-toc';
|
|
|
import breaks from 'remark-breaks';
|
|
|
+import remarkDirective from 'remark-directive';
|
|
|
+import remarkGithubAdmonitionsToDirectives from 'remark-github-admonitions-to-directives';
|
|
|
import math from 'remark-math';
|
|
|
import deepmerge from 'ts-deepmerge';
|
|
|
import type { Pluggable } from 'unified';
|
|
|
@@ -19,6 +21,7 @@ import { Header } from '~/client/components/ReactMarkdownComponents/Header';
|
|
|
import { LightBox } from '~/client/components/ReactMarkdownComponents/LightBox';
|
|
|
import { RichAttachment } from '~/client/components/ReactMarkdownComponents/RichAttachment';
|
|
|
import { TableWithEditButton } from '~/client/components/ReactMarkdownComponents/TableWithEditButton';
|
|
|
+import * as callout from '~/features/callout';
|
|
|
import * as mermaid from '~/features/mermaid';
|
|
|
import type { RendererOptions } from '~/interfaces/renderer-options';
|
|
|
import type { RendererConfig } from '~/interfaces/services/renderer';
|
|
|
@@ -65,6 +68,9 @@ export const generateViewOptions = (
|
|
|
mermaid.remarkPlugin,
|
|
|
xsvToTable.remarkPlugin,
|
|
|
attachment.remarkPlugin,
|
|
|
+ remarkGithubAdmonitionsToDirectives,
|
|
|
+ remarkDirective,
|
|
|
+ callout.remarkPlugin,
|
|
|
lsxGrowiDirective.remarkPlugin,
|
|
|
refsGrowiDirective.remarkPlugin,
|
|
|
);
|
|
|
@@ -78,6 +84,7 @@ export const generateViewOptions = (
|
|
|
presentation.sanitizeOption,
|
|
|
drawio.sanitizeOption,
|
|
|
mermaid.sanitizeOption,
|
|
|
+ callout.sanitizeOption,
|
|
|
attachment.sanitizeOption,
|
|
|
lsxGrowiDirective.sanitizeOption,
|
|
|
refsGrowiDirective.sanitizeOption,
|
|
|
@@ -112,6 +119,7 @@ export const generateViewOptions = (
|
|
|
components.drawio = DrawioViewerWithEditButton;
|
|
|
components.table = TableWithEditButton;
|
|
|
components.mermaid = mermaid.MermaidViewer;
|
|
|
+ components.callout = callout.CalloutViewer;
|
|
|
components.attachment = RichAttachment;
|
|
|
components.img = LightBox;
|
|
|
}
|
|
|
@@ -169,6 +177,9 @@ export const generateSimpleViewOptions = (
|
|
|
mermaid.remarkPlugin,
|
|
|
xsvToTable.remarkPlugin,
|
|
|
attachment.remarkPlugin,
|
|
|
+ remarkGithubAdmonitionsToDirectives,
|
|
|
+ remarkDirective,
|
|
|
+ callout.remarkPlugin,
|
|
|
lsxGrowiDirective.remarkPlugin,
|
|
|
refsGrowiDirective.remarkPlugin,
|
|
|
);
|
|
|
@@ -185,6 +196,7 @@ export const generateSimpleViewOptions = (
|
|
|
presentation.sanitizeOption,
|
|
|
drawio.sanitizeOption,
|
|
|
mermaid.sanitizeOption,
|
|
|
+ callout.sanitizeOption,
|
|
|
attachment.sanitizeOption,
|
|
|
lsxGrowiDirective.sanitizeOption,
|
|
|
refsGrowiDirective.sanitizeOption,
|
|
|
@@ -211,6 +223,7 @@ export const generateSimpleViewOptions = (
|
|
|
components.gallery = refsGrowiDirective.GalleryImmutable;
|
|
|
components.drawio = drawio.DrawioViewer;
|
|
|
components.mermaid = mermaid.MermaidViewer;
|
|
|
+ components.callout = callout.CalloutViewer;
|
|
|
components.attachment = RichAttachment;
|
|
|
components.img = LightBox;
|
|
|
}
|
|
|
@@ -262,6 +275,9 @@ export const generatePreviewOptions = (config: RendererConfig, pagePath: string)
|
|
|
mermaid.remarkPlugin,
|
|
|
xsvToTable.remarkPlugin,
|
|
|
attachment.remarkPlugin,
|
|
|
+ remarkGithubAdmonitionsToDirectives,
|
|
|
+ remarkDirective,
|
|
|
+ callout.remarkPlugin,
|
|
|
lsxGrowiDirective.remarkPlugin,
|
|
|
refsGrowiDirective.remarkPlugin,
|
|
|
);
|
|
|
@@ -274,6 +290,7 @@ export const generatePreviewOptions = (config: RendererConfig, pagePath: string)
|
|
|
getCommonSanitizeOption(config),
|
|
|
drawio.sanitizeOption,
|
|
|
mermaid.sanitizeOption,
|
|
|
+ callout.sanitizeOption,
|
|
|
attachment.sanitizeOption,
|
|
|
lsxGrowiDirective.sanitizeOption,
|
|
|
refsGrowiDirective.sanitizeOption,
|
|
|
@@ -301,6 +318,7 @@ export const generatePreviewOptions = (config: RendererConfig, pagePath: string)
|
|
|
components.gallery = refsGrowiDirective.GalleryImmutable;
|
|
|
components.drawio = drawio.DrawioViewer;
|
|
|
components.mermaid = mermaid.MermaidViewer;
|
|
|
+ components.callout = callout.CalloutViewer;
|
|
|
components.attachment = RichAttachment;
|
|
|
components.img = LightBox;
|
|
|
}
|