Skip to content

refactor: move the MarkdownIt and SyntaxHighlight components to a standalone project #2415

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
merged 4 commits into from
May 19, 2025

Conversation

capdiem
Copy link
Contributor

@capdiem capdiem commented May 19, 2025

Closes #2413

@capdiem capdiem requested a review from Copilot May 19, 2025 08:32
Copy link
Contributor

@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

Extracts the MarkdownIt and MSyntaxHighlight components into a standalone Masa.Blazor.JSComponents.MarkdownIt project, switches from DI-based JS module access to dynamic imports, and updates docs and solutions to reference the new package.

  • Refactor core rendering components to import and dispose JS modules directly.
  • Update Rollup config and include the new project in solution files.
  • Add installation instructions and usage section updates across multiple docs.

Reviewed Changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/Masa.Blazor.JSComponents.MarkdownIt/SyntaxHighlight/MSyntaxHighlight.razor.cs Replace injected MarkdownItJSModule with dynamic JS import and custom Highlight method
src/Masa.Blazor.JSComponents.MarkdownIt/Masa.Blazor.JSComponents.MarkdownIt.csproj Add standalone Razor SDK project for MarkdownIt JS components
src/Masa.Blazor.JSComponents.MarkdownIt/MarkdownIt/MarkdownItParsedResult.cs Remove unused System.Text.Json.Serialization using directive
src/Masa.Blazor.JSComponents.MarkdownIt/MarkdownIt/MarkdownItAnchorOptions.cs Minor grammar fix in XML doc comment
src/Masa.Blazor.JSComponents.MarkdownIt/MarkdownIt/MMarkdownIt.razor.cs Refactor to dynamic JS import, parameter‐change tracking, and parsing logic
src/Masa.Blazor.JS/rollup.config.markdownit.ts Update output path to new wwwroot/markdown-it.js file in standalone project
docs/Masa.Docs.Shared/wwwroot/js/markdown-parser.js Move addLinkRules call above duplicate invocation
docs/Masa.Docs.Core/Masa.Docs.Core.csproj Add project reference to new MarkdownIt JSComponents project
docs/Masa.Blazor.Docs/wwwroot/pages/components/syntax-highlights/zh-CN.md Add installation section for the new package
docs/Masa.Blazor.Docs/wwwroot/pages/components/syntax-highlights/en-US.md Add installation and separate usage heading
docs/Masa.Blazor.Docs/wwwroot/pages/components/markdown-parsers/zh-CN.md Add installation section and anchor IDs
docs/Masa.Blazor.Docs/wwwroot/pages/components/markdown-parsers/en-US.md Add installation section
docs/Masa.Blazor.Docs/Pages/Components.razor.cs Register MarkdownItApiGenerator.ComponentMetas in component list
docs/Masa.Blazor.Docs/Examples/components/markdown-parsers/Options.razor Wrap example in <MSheet> and adjust layout
Masa.Blazor.slnx Include the new JSComponents.MarkdownIt project
Masa.Blazor.Build.slnx Reorder and add MarkdownIt project alongside other component projects

@@ -6,6 +6,7 @@
<Project Path="src/Masa.Blazor.JSComponents.DriverJS/Masa.Blazor.JSComponents.DriverJS.csproj" />
<Project Path="src/Masa.Blazor.SomethingSkia/Masa.Blazor.SomethingSkia.csproj" />
<Project Path="src/Masa.Blazor/Masa.Blazor.csproj" />
<Project Path="src\Masa.Blazor.JSComponents.MarkdownIt\Masa.Blazor.JSComponents.MarkdownIt.csproj" Type="Classic C#" />
Copy link
Preview

Copilot AI May 19, 2025

Choose a reason for hiding this comment

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

[nitpick] Paths in solution files mix backslashes with forward slashes. Consider normalizing to forward slashes for consistency across platforms.

Copilot uses AI. Check for mistakes.

@MayueCif MayueCif merged commit 5dcd25a into main May 19, 2025
1 check passed
@MayueCif MayueCif deleted the release/mv-markdownit branch May 19, 2025 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

markdown-it
2 participants