Yuki Takei 3 лет назад
Родитель
Сommit
88e2c4a6b0

+ 1 - 0
packages/app/src/components/PagePresentationModal.tsx

@@ -52,6 +52,7 @@ const PagePresentationModal = (): JSX.Element => {
             revealOptions={{
               embedded: true,
               hash: true,
+              disableLayout: true,
             }}
           >
             {markdown}

+ 2 - 3
packages/presentation/src/components/PresentationWithReveal.tsx

@@ -5,8 +5,7 @@ import Reveal from 'reveal.js';
 
 
 import 'reveal.js/dist/reveal.css';
-import 'reveal.js/dist/theme/black.css';
-import { Sections } from './Sections';
+import { CONTAINER_CLASS_NAME, Sections } from './Sections';
 
 
 type Props = {
@@ -27,7 +26,7 @@ export const Presentation = (props: Props): JSX.Element => {
   }, [children, revealOptions]);
 
   return (
-    <div className="reveal">
+    <div className={`reveal ${CONTAINER_CLASS_NAME}`}>
       <div className="slides">
         <Sections rendererOptions={rendererOptions}>{children}</Sections>
       </div>

+ 16 - 5
packages/presentation/src/components/Sections.tsx

@@ -1,12 +1,16 @@
 import React from 'react';
 
-// import { Marp } from '@marp-team/marp-core';
+import { Marp } from '@marp-team/marp-core';
+import { Element } from '@marp-team/marpit';
 import Head from 'next/head';
 import { ReactMarkdown } from 'react-markdown/lib/react-markdown';
 import type { ReactMarkdownOptions } from 'react-markdown/lib/react-markdown';
 
 import * as hrSplitter from '../services/renderer/hr-splitter';
 
+
+export const CONTAINER_CLASS_NAME = 'marpit';
+
 type SectionsProps = {
   rendererOptions: ReactMarkdownOptions,
   children?: string,
@@ -17,15 +21,22 @@ export const Sections = (props: SectionsProps): JSX.Element => {
 
   rendererOptions.remarkPlugins?.push(hrSplitter.remarkPlugin);
 
-  // const marp = new Marp();
-  // const { css } = marp.render('', { htmlAsArray: true });
+  const marp = new Marp({
+    container: [
+      new Element('div', { class: CONTAINER_CLASS_NAME }),
+      new Element('div', { class: 'slides' }),
+    ],
+    inlineSVG: false,
+  });
+  const { css } = marp.render('', { htmlAsArray: true });
+
   return (
     <>
       <Head>
-        {/* <style>{css}</style> */}
+        <style>{css}</style>
       </Head>
       { children == null
-        ? <section>No contents</section>
+        ? <section><h2>No contents</h2></section>
         : <ReactMarkdown {...rendererOptions}>{children}</ReactMarkdown>
       }
     </>