diff --git a/components/presentation/Presentation.jsx b/components/presentation/Presentation.jsx index f29bfc4..e1875a2 100644 --- a/components/presentation/Presentation.jsx +++ b/components/presentation/Presentation.jsx @@ -5,6 +5,17 @@ import Reveal from 'reveal.js'; import 'reveal.js/dist/reveal.css'; import { marked } from 'marked'; +const parseThemeFromContent = (content) => { + if (!content || !content.startsWith('---')) return null; + + const frontmatterEnd = content.indexOf('---', 3); + if (frontmatterEnd === -1) return null; + + const frontmatter = content.substring(3, frontmatterEnd); + const themeMatch = frontmatter.match(/theme:\s*(\w+)/); + return themeMatch ? themeMatch[1] : null; +}; + const loadTheme = async (themeName) => { if (!themeName) return; @@ -152,7 +163,7 @@ export default function Presentation({ data }) { revealRef.current.destroy(); } - const themeName = data.theme || 'default'; + const themeName = data.theme || parseThemeFromContent(data.content) || 'default'; await loadTheme(themeName); revealRef.current = new Reveal(deckRef.current, REVEAL_CONFIG);