markdown-frontmatter.spec.ts 800 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { describe, expect, it } from 'vitest'
  2. import { stripMarkdownFrontmatter } from '../packages/renderers/text/src/markdown'
  3. describe('@file-viewer/renderer-text markdown frontmatter', () => {
  4. it('removes YAML frontmatter without stripping body slide separators', () => {
  5. const markdown = `---
  6. # metadata comments stay out of the rendered document
  7. name: html-to-ppt
  8. tags:
  9. - slides
  10. ---
  11. # HTML/Markdown to PowerPoint Skill
  12. Intro text.
  13. ---
  14. # Slide 2
  15. `
  16. expect(stripMarkdownFrontmatter(markdown)).toBe(`# HTML/Markdown to PowerPoint Skill
  17. Intro text.
  18. ---
  19. # Slide 2
  20. `)
  21. })
  22. it('keeps ordinary markdown that does not start with a frontmatter fence', () => {
  23. const markdown = `# Demo
  24. ---
  25. Body divider
  26. `
  27. expect(stripMarkdownFrontmatter(markdown)).toBe(markdown)
  28. })
  29. })