MakeSense for GitHub — Make Sense of Any GitHub PR, with full cognitive coverage of every change.
gogs/gogs#8400 — 7 files, 1 review comment
Implement GitHub-style Markdown Alerts
Overview
This change introduces support for rendering GitHub-style Markdown alerts. It transforms specific blockquote patterns into visually distinct callout boxes. The implementation includes custom HTML generation, updated security policies, and new styling rules.
Technical Highlights
internal/markup/markdown.go: Overrides Markdown blockquote rendering to convert alert patterns into custom HTML `div` elements.
internal/markup/markdown_test.go: Adds extensive unit tests to validate correct HTML output for all alert types and scenarios.
internal/markup/sanitizer.go: Updates HTML sanitizer to explicitly allow new alert-specific `div`, `p`, `span` elements, classes, and attributes.
internal/markup/sanitizer_test.go: Extends sanitizer tests to verify correct allowance of alert-related HTML and rejection of invalid elements.
public/less/_markdown.less: Introduces LESS styling rules for alert containers, titles, and distinct color schemes for each alert type.
Impact
Functionality: Users can now create visually distinct GitHub-style Markdown alerts within content.
Risk: Incorrect HTML sanitizer configuration could introduce Cross-Site Scripting (XSS) vulnerabilities.
Files reviewed
- CHANGELOG.md — 0 comment(s)
- internal/markup/markdown.go — 1 comment(s)
- internal/markup/markdown_test.go — 0 comment(s)
- internal/markup/sanitizer.go — 0 comment(s)
- internal/markup/sanitizer_test.go — 0 comment(s)
- public/css/gogs.min.css — 0 comment(s)
- public/less/_markdown.less — 0 comment(s)
View the full interactive review (JavaScript required).