Feat/markdown improvements - #545
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Address the critical unescaped info-string injection and the Bootstrap table-renderer registration issue.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds Markdown rendering improvements for external links, task lists, code badges, responsive tables, and TOC text handling.
Changes:
- Adds external-link indicators and styling.
- Adds responsive table wrapping, task-list styling, and code-language badges.
- Updates extension registration, TOC filtering, and unit tests.
File summaries
| File | Summary | Review notes |
|---|---|---|
tests/LinkDotNet.Blog.UnitTests/Web/Features/MarkdownConverterTests.cs |
Tests new Markdown behaviors. | Reviewed. |
src/LinkDotNet.Blog.Web/wwwroot/css/basic.css |
Styles task lists and code badges. | Reviewed. |
src/LinkDotNet.Blog.Web/Features/ResponsiveTableExtension.cs |
Wraps rendered tables responsively. | Moderate issue: the renderer lookup may miss Bootstrap’s specialized renderer, preventing registration. |
src/LinkDotNet.Blog.Web/Features/MarkdownConverter.cs |
Registers extensions and filters inline HTML from TOC text. | Reviewed. |
src/LinkDotNet.Blog.Web/Features/ExternalLinkExtension.cs |
Marks HTTP(S) links as external. | Reviewed. |
src/LinkDotNet.Blog.Web/Features/CopyCodeBlockToClipboardExtension.cs |
Adds code-language badges and extension registration. | Critical issue: unescaped fenced-code info strings can inject markup or scripts. |
Review details
Suppressed comments (1)
src/LinkDotNet.Blog.Web/Features/ResponsiveTableExtension.cs:21
- This extension is registered after
UseBootstrap(), butFindExact<HtmlTableRenderer>()only matches the base renderer. Bootstrap installs a specialized renderer for its table class (the existingCalloutExtensionhas to use an assignable lookup for the same reason), so this lookup can return null and the responsive wrapper is never registered; the newtable-containerbehavior then does not occur. Find and replace the active Bootstrap table renderer while preserving its Bootstrap rendering behavior.
var originalTableRenderer = htmlRenderer.ObjectRenderers.FindExact<HtmlTableRenderer>();
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| renderer.Write("""<div class="position-relative">"""); | ||
| if (obj is FencedCodeBlock { Info.Length: > 0 } fenced) | ||
| { | ||
| renderer.Write($"""<span class="badge bg-secondary position-absolute top-0 start-0 m-2 code-lang-badge">{fenced.Info}</span>"""); |
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.
No description provided.