Add GitLab Flavored Markdown (GLFM) flavour - #214
Draft
Aboobacker MK (tachyons) wants to merge 1 commit into
Draft
Aboobacker MK (tachyons) wants to merge 1 commit into
Aboobacker MK (tachyons) wants to merge 1 commit into
Conversation
Introduces GLFMFlavourDescriptor, extending GFMFlavourDescriptor with
GitLab-specific markdown features:
- Inline diffs: {+ addition +} / [- deletion -] (with and without spaces,
restricted to a single line)
- Emoji shortcodes: :name: with a customizable emoji map
- GitLab references: @user, #issue, !merge_request, $snippet, &epic,
~label (incl. quoted ~"multi word"), %milestone, and cross-project
group/project#id, rendered as links with gfm-* classes
- Alerts: > [!note|tip|important|caution|warning] blockquotes rendered
as styled gl-alert containers
- Multiline blockquotes: >>> ... >>> fences
All features are implemented in commonMain on top of the existing GFM
lexer and parser infrastructure (sequential parsers, marker blocks and
HTML generating providers), with no changes to existing files.
Covered by 100+ unit tests in GLFMFeaturesTest, including edge cases
like emoji false positives (times, spaced colons), array indexing not
being a deletion, emails not being mentions, and word-boundary rules
for numeric references.
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
This PR introduces a new
GLFMFlavourDescriptorimplementing GitLab Flavored Markdown on top of the existingGFMFlavourDescriptor.Features
{+ added +}/{+added+}<span class="idiff addition">[- removed -]/[-removed-]<span class="idiff deletion">:smile:,:+1:<span class="gl-emoji">with Unicode emoji (customizable map)@usergfm-project_member#123,group/project#123gfm-issue!123gfm-merge_request$123/&123gfm-snippet/gfm-epiclinks~bug,~"multi word"gfm-label%v1.0gfm-milestone> [!note](also tip/important/caution/warning)<div class="gl-alert gl-alert-note">>>>…>>><blockquote>Design notes
flavours/glfmpackage (commonMain) plus one test file.SequentialParserimplementations (InlineDiffParser,EmojiParser,GitLabReferenceParser) that work with the token shapes the GFM lexer produces.MarkerBlockProvider+MarkerBlockpair; the fence artifacts are flattened at HTML generation time.[!note]marker parses as aSHORT_REFERENCE_LINK, which the alert provider recognizes and strips).#123abcis not a reference),arr[-1]is not a deletion,~~strikethrough~~is not a label, emails are not mentions, and emoji names cannot contain whitespace.Configuration
Testing
GLFMFeaturesTestcovering every feature, inherited GFM behaviour (math, strikethrough, tables, task lists) and edge-case interactions.jvmTestsuite passes (1617 tests, 0 failures); JS target compiles.Notes for reviewers
see group/project#1) are not detected because the GFM lexer emits the whole phrase as one TEXT token which sequential parsers cannot split; standalone occurrences work.gitlabBaseUrl/gitlabProjectstring params).