|
@@ -1,10 +1,11 @@
|
|
|
import assert from 'assert';
|
|
import assert from 'assert';
|
|
|
|
|
|
|
|
import { isClient } from '@growi/core/dist/utils/browser-utils';
|
|
import { isClient } from '@growi/core/dist/utils/browser-utils';
|
|
|
-import * as refsGrowiDirective from '@growi/remark-attachment-refs/dist/client/index.mjs';
|
|
|
|
|
|
|
+import * as slides from '@growi/presentation';
|
|
|
|
|
+import * as refsGrowiDirective from '@growi/remark-attachment-refs/dist/client';
|
|
|
import * as drawio from '@growi/remark-drawio';
|
|
import * as drawio from '@growi/remark-drawio';
|
|
|
// eslint-disable-next-line import/extensions
|
|
// eslint-disable-next-line import/extensions
|
|
|
-import * as lsxGrowiDirective from '@growi/remark-lsx/dist/client/index.mjs';
|
|
|
|
|
|
|
+import * as lsxGrowiDirective from '@growi/remark-lsx/dist/client';
|
|
|
import katex from 'rehype-katex';
|
|
import katex from 'rehype-katex';
|
|
|
import sanitize from 'rehype-sanitize';
|
|
import sanitize from 'rehype-sanitize';
|
|
|
import slug from 'rehype-slug';
|
|
import slug from 'rehype-slug';
|
|
@@ -18,6 +19,7 @@ import { DrawioViewerWithEditButton } from '~/components/ReactMarkdownComponents
|
|
|
import { Header } from '~/components/ReactMarkdownComponents/Header';
|
|
import { Header } from '~/components/ReactMarkdownComponents/Header';
|
|
|
import { LightBox } from '~/components/ReactMarkdownComponents/LightBox';
|
|
import { LightBox } from '~/components/ReactMarkdownComponents/LightBox';
|
|
|
import { RichAttachment } from '~/components/ReactMarkdownComponents/RichAttachment';
|
|
import { RichAttachment } from '~/components/ReactMarkdownComponents/RichAttachment';
|
|
|
|
|
+import { SlideViewer } from '~/components/ReactMarkdownComponents/SlideViewer';
|
|
|
import { TableWithEditButton } from '~/components/ReactMarkdownComponents/TableWithEditButton';
|
|
import { TableWithEditButton } from '~/components/ReactMarkdownComponents/TableWithEditButton';
|
|
|
import * as mermaid from '~/features/mermaid';
|
|
import * as mermaid from '~/features/mermaid';
|
|
|
import { RehypeSanitizeOption } from '~/interfaces/rehype';
|
|
import { RehypeSanitizeOption } from '~/interfaces/rehype';
|
|
@@ -66,6 +68,7 @@ export const generateViewOptions = (
|
|
|
attachment.remarkPlugin,
|
|
attachment.remarkPlugin,
|
|
|
lsxGrowiDirective.remarkPlugin,
|
|
lsxGrowiDirective.remarkPlugin,
|
|
|
refsGrowiDirective.remarkPlugin,
|
|
refsGrowiDirective.remarkPlugin,
|
|
|
|
|
+ [slides.remarkPlugin, { isEnabledMarp: config.isEnabledMarp }],
|
|
|
);
|
|
);
|
|
|
if (config.isEnabledLinebreaks) {
|
|
if (config.isEnabledLinebreaks) {
|
|
|
remarkPlugins.push(breaks);
|
|
remarkPlugins.push(breaks);
|
|
@@ -81,6 +84,7 @@ export const generateViewOptions = (
|
|
|
drawio.sanitizeOption,
|
|
drawio.sanitizeOption,
|
|
|
mermaid.sanitizeOption,
|
|
mermaid.sanitizeOption,
|
|
|
attachment.sanitizeOption,
|
|
attachment.sanitizeOption,
|
|
|
|
|
+ slides.sanitizeOption,
|
|
|
lsxGrowiDirective.sanitizeOption,
|
|
lsxGrowiDirective.sanitizeOption,
|
|
|
refsGrowiDirective.sanitizeOption,
|
|
refsGrowiDirective.sanitizeOption,
|
|
|
)]
|
|
)]
|
|
@@ -115,6 +119,7 @@ export const generateViewOptions = (
|
|
|
components.mermaid = mermaid.MermaidViewer;
|
|
components.mermaid = mermaid.MermaidViewer;
|
|
|
components.attachment = RichAttachment;
|
|
components.attachment = RichAttachment;
|
|
|
components.img = LightBox;
|
|
components.img = LightBox;
|
|
|
|
|
+ components.slide = SlideViewer;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (config.isEnabledXssPrevention) {
|
|
if (config.isEnabledXssPrevention) {
|
|
@@ -257,6 +262,7 @@ export const generatePreviewOptions = (config: RendererConfig, pagePath: string)
|
|
|
attachment.remarkPlugin,
|
|
attachment.remarkPlugin,
|
|
|
lsxGrowiDirective.remarkPlugin,
|
|
lsxGrowiDirective.remarkPlugin,
|
|
|
refsGrowiDirective.remarkPlugin,
|
|
refsGrowiDirective.remarkPlugin,
|
|
|
|
|
+ [slides.remarkPlugin, { isEnabledMarp: config.isEnabledMarp }],
|
|
|
);
|
|
);
|
|
|
if (config.isEnabledLinebreaks) {
|
|
if (config.isEnabledLinebreaks) {
|
|
|
remarkPlugins.push(breaks);
|
|
remarkPlugins.push(breaks);
|
|
@@ -275,6 +281,7 @@ export const generatePreviewOptions = (config: RendererConfig, pagePath: string)
|
|
|
lsxGrowiDirective.sanitizeOption,
|
|
lsxGrowiDirective.sanitizeOption,
|
|
|
refsGrowiDirective.sanitizeOption,
|
|
refsGrowiDirective.sanitizeOption,
|
|
|
addLineNumberAttribute.sanitizeOption,
|
|
addLineNumberAttribute.sanitizeOption,
|
|
|
|
|
+ slides.sanitizeOption,
|
|
|
)]
|
|
)]
|
|
|
: () => {};
|
|
: () => {};
|
|
|
|
|
|
|
@@ -299,6 +306,7 @@ export const generatePreviewOptions = (config: RendererConfig, pagePath: string)
|
|
|
components.mermaid = mermaid.MermaidViewer;
|
|
components.mermaid = mermaid.MermaidViewer;
|
|
|
components.attachment = RichAttachment;
|
|
components.attachment = RichAttachment;
|
|
|
components.img = LightBox;
|
|
components.img = LightBox;
|
|
|
|
|
+ components.slide = SlideViewer;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (config.isEnabledXssPrevention) {
|
|
if (config.isEnabledXssPrevention) {
|