{{ message }}
Repository navigation
Commit c2a7f59
authored
* feat: support GitLab inline diff and multiline blockquote (#954)
Add two off-by-default preferences that read the GitLab Flavored Markdown
extensions MarkText was missing, in the editor and in every export path.
- `inlineDiff` renders `{+ … +}` / `[+ … +]` additions as `<ins>` and
`{- … -}` / `[- … -]` deletions as `<del>`. The opener and closer must
match, the body is plain text (no nested markdown), and the span is
line-scoped — all matching GitLab's own diff filter.
- `multilineBlockquote` reads `>>>` … `>>>` fenced blockquotes. They reuse
the existing block-quote block; a `meta.style = 'fenced'` flag only drives
markdown serialization so the fence round-trips instead of collapsing to
`>`. Typing `>>>` alone on a line and pressing Enter opens one.
Editor rules live in muya (inline tokens + a block extension); the HTML /
PDF / print and copy-as-HTML paths get matching marked extensions wired
through getHighlightHtml, getClipboardHtml, MarkdownToHtml and
renderToStaticHTML. Pandoc has no native reader extension for either
syntax, so the Pandoc export flags are unchanged.
Adds the two preferences to the schema, shipped defaults, Preferences UI,
editor option plumbing and all 12 locales, plus the markdown syntax and
preferences docs. Verified with engine unit + CommonMark/GFM spec suites.
Refs #954
* fix: address inline diff / multiline blockquote review feedback (#954)
- A run of `>` with nothing else no longer auto-promotes to a blockquote
while `multilineBlockquote` is on, so typing `>>>` reaches the fence
instead of being swallowed after the second character.
- An empty or whitespace-only diff body (`{++}`, `{+ +}`) stays literal,
matching how `**` behaves.
- Inline diff delimiters are matched by four explicit regexes, one per
valid opener/closer pair, instead of the hand-rolled `tryInlineDiff`
bracket check. JS regex has no branch-reset groups, so `{` cannot be
back-referenced to `}`; one pattern per pair keeps the pairing in the
regex while the shared `tryChunks` pipeline handles the token.
- Inline diffs render like GitLab's `.idiff`: a green wash for additions
and a red one for deletions (no underline / strikethrough), in the
editor and in the exported HTML. The colours are exposed as
`--code-new/old-inline-diff-background-color` for themes.
- Drop the added comments that only restated the code.
Refs #954
* fix: keep `>>>` fences literal while multilineBlockquote is off (#954)
Copilot review: enabling the preference on an already-open document could
not recognise existing fences. With the option off, Marked had already
folded each fence into ordinary nested blockquote state, and re-parsing
`getMarkdown()` then emitted spaced `> > >` markers the extension could
no longer match.
The `multilineBlockquote` extension is now always registered and, while
the preference is off, returns a literal paragraph instead of a nested
blockquote. That keeps `>>>` verbatim on load, save and export — the same
"stays literal while off" behaviour as `==` under `highlightSyntax` — and
gives an off → on toggle the fence it needs to rebuild the quote. The
marked export path follows the same rule.
Only the fence shape (`>>>` alone on a line, closed by `>>>` alone on a
line) is affected; `>>> foo` and the other CommonMark blockquote spellings
are untouched.
Refs #954
1 parent 67ea037 commit c2a7f59
54 files changed
Lines changed: 882 additions & 22 deletions
File tree
- packages
- desktop
- src
- main/preferences
- renderer/src
- components/editorWithTabs
- prefComponents/markdown
- store
- static
- locales
- muya/src
- assets/styles
- block
- base
- commonMark/blockQuote
- content/paragraphContent
- __tests__
- clipboard
- config
- inlineRenderer
- __tests__
- renderer
- state
- __tests__
- utils/marked
- extensions
- website/content/docs/end-user
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| 200 | + | |
| 201 | + | |
200 | 202 | | |
201 | 203 | | |
202 | 204 | | |
| |||
608 | 610 | | |
609 | 611 | | |
610 | 612 | | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
611 | 621 | | |
612 | 622 | | |
613 | 623 | | |
| |||
1778 | 1788 | | |
1779 | 1789 | | |
1780 | 1790 | | |
| 1791 | + | |
| 1792 | + | |
1781 | 1793 | | |
1782 | 1794 | | |
1783 | 1795 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
96 | 108 | | |
97 | 109 | | |
98 | 110 | | |
| |||
194 | 206 | | |
195 | 207 | | |
196 | 208 | | |
| 209 | + | |
| 210 | + | |
197 | 211 | | |
198 | 212 | | |
199 | 213 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| |||
205 | 207 | | |
206 | 208 | | |
207 | 209 | | |
| 210 | + | |
| 211 | + | |
208 | 212 | | |
209 | 213 | | |
210 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
| 422 | + | |
| 423 | + | |
422 | 424 | | |
423 | 425 | | |
424 | 426 | | |
| |||
648 | 650 | | |
649 | 651 | | |
650 | 652 | | |
| 653 | + | |
| 654 | + | |
651 | 655 | | |
652 | 656 | | |
653 | 657 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
| 421 | + | |
| 422 | + | |
421 | 423 | | |
422 | 424 | | |
423 | 425 | | |
| |||
648 | 650 | | |
649 | 651 | | |
650 | 652 | | |
| 653 | + | |
| 654 | + | |
651 | 655 | | |
652 | 656 | | |
653 | 657 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
| 422 | + | |
| 423 | + | |
422 | 424 | | |
423 | 425 | | |
424 | 426 | | |
| |||
648 | 650 | | |
649 | 651 | | |
650 | 652 | | |
| 653 | + | |
| 654 | + | |
651 | 655 | | |
652 | 656 | | |
653 | 657 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
| 422 | + | |
| 423 | + | |
422 | 424 | | |
423 | 425 | | |
424 | 426 | | |
| |||
648 | 650 | | |
649 | 651 | | |
650 | 652 | | |
| 653 | + | |
| 654 | + | |
651 | 655 | | |
652 | 656 | | |
653 | 657 | | |
| |||

0 commit comments