Extract MDX compilation logic and enable MDX in all frontmatter values#525
Merged
Extract MDX compilation logic and enable MDX in all frontmatter values#525
Conversation
Co-authored-by: abernier <76580+abernier@users.noreply.github.com>
Co-authored-by: abernier <76580+abernier@users.noreply.github.com>
Co-authored-by: abernier <76580+abernier@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for MDX content in frontmatter values
Extract MDX compilation logic and enable MDX in frontmatter values
Jan 30, 2026
abernier
reviewed
Jan 30, 2026
… frontmatter, add title support Co-authored-by: abernier <76580+abernier@users.noreply.github.com>
Contributor
Author
|
All feedback addressed in commit 86b393d:
The PR now supports MDX in any frontmatter value (title, description, etc.). |
Copilot
AI
changed the title
Extract MDX compilation logic and enable MDX in frontmatter values
Extract MDX compilation logic and enable MDX in all frontmatter values
Jan 30, 2026
abernier
reviewed
Jan 30, 2026
Co-authored-by: abernier <76580+abernier@users.noreply.github.com>
Contributor
Author
abernier
reviewed
Jan 30, 2026
…field Co-authored-by: abernier <76580+abernier@users.noreply.github.com>
Contributor
Author
|
All feedback addressed in commit 9e304d2:
|
abernier
reviewed
Jan 30, 2026
abernier
reviewed
Jan 30, 2026
Co-authored-by: abernier <76580+abernier@users.noreply.github.com>
abernier
reviewed
Jan 30, 2026
Comment on lines
+108
to
+113
| expect(html).toContain('<div') | ||
| expect(html).toContain('<pre') | ||
| expect(html).toContain('<code') | ||
| expect(html).toContain('const') | ||
| expect(html).toContain('x') | ||
| expect(html).toContain('1') |
Member
There was a problem hiding this comment.
@copilot tu peux pas plutot faire comme pour le test d'apres, avec les [^] ?
Contributor
Author
There was a problem hiding this comment.
Mis à jour dans commit 8506959. Remplacé .toContain('<div'), .toContain('<pre'), .toContain('<code') par .toMatch(/<div[^>]*>/), .toMatch(/<pre[^>]*>/), .toMatch(/<code[^>]*>/) pour cohérence avec les autres tests.
Co-authored-by: abernier <76580+abernier@users.noreply.github.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary: Support MDX Content in Frontmatter Values ✅
Successfully implemented MDX support in frontmatter values, allowing markdown formatting in fields like description and title.
Changes Made:
✅ Extracted MDX compilation logic into
src/utils/compileMdxContent.tsx:compileMdxContent()- Full MDX compilation with all plugins (for document content)compileMdxFrontmatter()- Simplified MDX compilation for inline content (for frontmatter values)Entrytype from@/components/mdx/Entries✅ Simplified Doc type to use compiled ReactNode values:
title?: ReactNode- Compiled MDX title for displaydescription?: ReactNode- Compiled MDX description for displaymetadata: { title: string; description: string }- Raw strings for SEO metadata✅ Always compile frontmatter: No optimization - all frontmatter values are compiled as MDX
✅ Updated page rendering to use ReactNode
titleanddescriptiondirectly, withmetadatafor SEO✅ Comprehensive testing: 9 unit tests that validate HTML structure without coupling to CSS classes
[^>]*to match HTML elements.toMatch()with regex for HTML structure validation✅ Updated example:
docs/authoring/intro.mdxdemonstrates MDX in both title and description✅ Documentation: Added comprehensive documentation in
docs/authoring/introduction.mdxExample Usage:
Both title and description render with proper formatting! The compiled ReactNode values are used for display, while raw strings are preserved in the
metadataobject for SEO purposes.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.