Просмотр исходного кода

activate marp by excluding from @growi/presentation

Yuki Takei 3 лет назад
Родитель
Сommit
a27006fef0
2 измененных файлов с 20 добавлено и 15 удалено
  1. 14 14
      packages/presentation/src/components/Slides.tsx
  2. 6 1
      packages/presentation/vite.config.ts

+ 14 - 14
packages/presentation/src/components/Slides.tsx

@@ -1,7 +1,7 @@
 import React from 'react';
 
-// import { Marp } from '@marp-team/marp-core';
-// import { Element } from '@marp-team/marpit';
+import { Marp } from '@marp-team/marp-core';
+import { Element } from '@marp-team/marpit';
 import Head from 'next/head';
 import ReactMarkdown from 'react-markdown';
 
@@ -13,16 +13,16 @@ import './Slides.global.scss';
 export const MARP_CONTAINER_CLASS_NAME = 'marpit';
 
 
-// const marp = new Marp({
-//   container: [
-//     new Element('div', { class: MARP_CONTAINER_CLASS_NAME }),
-//     new Element('div', { class: 'slides' }),
-//   ],
-//   inlineSVG: false,
-//   emoji: undefined,
-//   html: false,
-//   math: false,
-// });
+const marp = new Marp({
+  container: [
+    new Element('div', { class: MARP_CONTAINER_CLASS_NAME }),
+    new Element('div', { class: 'slides' }),
+  ],
+  inlineSVG: false,
+  emoji: undefined,
+  html: false,
+  math: false,
+});
 
 
 type Props = {
@@ -42,12 +42,12 @@ export const Slides = (props: Props): JSX.Element => {
     },
   ]);
 
-  // const { css } = marp.render('', { htmlAsArray: true });
+  const { css } = marp.render('', { htmlAsArray: true });
 
   return (
     <>
       <Head>
-        {/* <style>{css}</style> */}
+        <style>{css}</style>
       </Head>
       <ReactMarkdown {...rendererOptions}>
         { children ?? '## No Contents' }

+ 6 - 1
packages/presentation/vite.config.ts

@@ -16,7 +16,12 @@ export default defineConfig({
       formats: ['es'],
     },
     rollupOptions: {
-      external: ['react', 'react-dom', 'next/head', 'react-markdown'],
+      external: [
+        'react', 'react-dom',
+        'next/head',
+        'react-markdown',
+        '@marp-team/marp-core', '@marp-team/marpit',
+      ],
       output: {
         globals: {
           react: 'React',