Skip to content

feat: add support for Markdown Front Matter parsing #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

lumirlumir
Copy link
Contributor

@lumirlumir lumirlumir commented Apr 19, 2025

Prerequisites checklist

What is the purpose of this pull request?

Hello,

I've added support for Markdown Front Matter parsing in code-explorer!

This feature leverages the newly introduced Front Matter parsing capability in @eslint/[email protected]. (eslint/markdown#328)

code-explorer now supports parsing Front Matter in both yaml and toml formats.

  • yaml

image

  • toml

image

  • options

image

What changes did you make? (Give an overview)

I've added markdownFrontmatter options to properly parse both yaml and toml front matter.

I've also introduced an Off option, which is interpreted as the boolean false.

Related Issues

eslint/markdown#328

Is there anything you'd like reviewers to focus on?

Copy link

netlify bot commented Apr 19, 2025

Deploy Preview for eslint-code-explorer ready!

Name Link
🔨 Latest commit 67cd6d2
🔍 Latest deploy log https://app.netlify.com/sites/eslint-code-explorer/deploys/6807b075c4440f0008056929
😎 Deploy Preview https://deploy-preview-92--eslint-code-explorer.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@lumirlumir lumirlumir mentioned this pull request Apr 18, 2025
7 tasks
@nzakas
Copy link
Member

nzakas commented Apr 21, 2025

This is looking good. Can you please check the CI failures?

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds support for Markdown Front Matter parsing in code-explorer by introducing a new front matter option that supports "yaml" and "toml" formats as well as an "off" setting.

  • Added a new constant array for front matter options in src/lib/const.ts
  • Extended option types in src/hooks/use-explorer.ts and enabled corresponding parsing in src/hooks/use-ast.ts
  • Updated the options component in src/components/options.tsx to include a front matter selection dropdown

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

File Description
src/lib/const.ts Introduced markdownFrontmatters constant and updated defaultMarkdownOptions
src/hooks/use-explorer.ts Added MarkdownFrontmatter type
src/hooks/use-ast.ts Updated AST parsing to use front matter setting
src/components/options.tsx Added LabeledSelect for markdownFrontmatter
Files not reviewed (1)
  • package.json: Language not supported
Comments suppressed due to low confidence (1)

src/lib/const.ts:193

  • [nitpick] The constant name 'markdownFrontmatters' is inconsistent with the singular option property 'markdownFrontmatter' used elsewhere. Consider renaming it (e.g., 'markdownFrontmatterOptions') for improved clarity.
export const markdownFrontmatters = [

@lumirlumir lumirlumir marked this pull request as draft April 22, 2025 08:02
@lumirlumir lumirlumir marked this pull request as ready for review April 22, 2025 08:42
@lumirlumir lumirlumir marked this pull request as draft April 22, 2025 15:00
@lumirlumir lumirlumir requested a review from nzakas April 22, 2025 15:08
@lumirlumir lumirlumir marked this pull request as ready for review April 22, 2025 15:08
Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@nzakas nzakas merged commit 75c0ee9 into eslint:main Apr 23, 2025
8 checks passed
@lumirlumir lumirlumir deleted the feat-support-markdown-frontmatter-parsing branch April 23, 2025 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants