[markdown] Implement `$` and `$$` for math fencing in math filter
What does this MR do and why?
Add the $...$
and $$...$$
syntax for inline and display math in markdown documents.
We're following the Pandoc syntax from https://pandoc.org/MANUAL.html#extension-tex_math_dollars:
Anything between two
$
characters will be treated as TeX math. The opening$
must have a non-space character immediately to its right, while the closing$
must have a non-space character immediately to its left, and must not be followed immediately by a digit. Thus,$20,000 and $30,000
won’t parse as math. If for some reason you need to enclose text in literal$
characters, backslash-escape them and they won’t be treated as math delimiters.For display math, use
$$
delimiters. (In this case, the delimiters may be separated from the formula by whitespace. However, there can be no blank lines between the opening and closing$$
delimiters.)
Backslash-escaped $
does not work in this MR. See https://gitlab.com/gitlab-org/gitlab/-/work_items/113462870
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Enable the feature flag markdown_dollar_math
for a group
group = Group.find_by_full_path('flightjs')
Feature.enable(:markdown_dollar_math, group)
Test Data, will render correctly only when MR is deployed
$...$
syntax
inline math using -
$2+2$
: -
$22+1$ and $2390985 + a^2$
:and -
$2390985 and $2+2$
: $2390985 and -
and $2+2$
: and -
$2+2$ $2390985 and gitlab-org/gitlab$2390985 $2+2$
:$2390985 and $2390985
$`...`$
syntax
inline math using -
$`2+2`$
: -
$`22+1`$ and $`22 + a^2`$
:and -
$2390985 and $`2+2`$
: $2390985 and -
and $`2+2`$
: and -
$`2+2`$ $2390985 and gitlab-org/gitlab$2390985 $`2+2`$
:$2390985 and $2390985 -
test $$`2+2`$$ test
: test $$ test
```math...```
syntax
display math using -
Block math using
```math...```
$$...$$
syntax
inline display math using -
$$2+2$$
: -
$$22+1$$ and $$22 + a^2$$
:and -
$2390985 and $$2+2$$
: $2390985 and -
$$2+2$$ $2390985 and gitlab-org/gitlab$2390985 $$2+2$$
:$2390985 and $2390985 -
gitlab-org/gitlab$2390985 and $$a^2 + b^2 = c^2$$
: $2390985 and
$$\n...\n$$
syntax
block display math using -
$$\n2+2\n$$
:$$ 2+2 $$
properly ignored syntax
-
$20,000 and $30,000
: $20,000 and $30,000 -
and $2+\$2$
: and -
`2+2`
:2+2
-
test $`2+2` test
: test $2+2
test -
test `2+2`$ test
: test2+2
$ test -
_$_`2+2`_$_
: $_2+2
_$ -
test $$\n2+2\n$$
test $$ 2+2 $$
Not working
- using a literal dollar sign
\$
in the math doesn't work
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #21757 (closed) and https://gitlab.com/gitlab-org/gitlab/-/work_items/113462870
Merge request reports
Activity
changed milestone to %Backlog
assigned to @digitalmoksha
- Resolved by 🤖 GitLab Bot 🤖
@digitalmoksha - please add typebug typefeature, typemaintenance or a subtype label to this merge request.- typebug: Defects in shipped code and fixes for those defects. This includes all the bug types (availability, performance, security vulnerability, mobile, etc.)
- typefeature: Effort to deliver new features, feature changes & improvements. This includes all changes as part of new product requirements like application limits.
- typemaintenance: Up-keeping efforts & catch-up corrective improvements that are not Features nor Bugs. This includes restructuring for long-term maintainability, stability, reducing technical debt, improving the contributor experience, or upgrading dependencies.
See the handbook for more guidance on classifying.
This message was created with automation and Engineering Productivity is looking for feedback in this issue:
https://gitlab.com/gitlab-org/quality/engineering-productivity/team/-/issues/43
removed [deprecated] Accepting merge requests label
added 1 commit
-
6d0e0570 - Support
…
syntax for inline math in markdown
-
6d0e0570 - Support
Suggested Reviewers (beta)
The individuals below may be good candidates to participate in the review based on various factors.
You can use slash commands in comments to quickly assign
/assign_reviewer @user1
.Suggested Reviewers @rspeicher
,@engwan
,@digitalmoksha
,@rymai
,@dzaporozhets
If you do not believe these suggestions are useful, please apply the label Bad Suggested Reviewer. You can also provide feedback for this feature on this issue:
https://gitlab.com/gitlab-org/gitlab/-/issues/357923
.Automatically generated by Suggested Reviewers Bot - an experimental ML-based recommendation engine created by ~"group::applied ml".
Edited by GitLab Reviewer-Recommender Bot- A deleted user
added backend label
1 Message This merge request adds or changes documentation files. A review from the Technical Writing team before you merge is recommended. Reviews can happen after you merge. Documentation review
The following files require a review from a technical writer:
doc/user/markdown.md
The review does not need to block merging this merge request. See the:
-
Metadata for the
*.md
files that you've changed. The first few lines of each*.md
file identify the stage and group most closely associated with your docs change. - The Technical Writer assigned for that stage and group.
- Documentation workflows for information on when to assign a merge request for review.
Reviewer roulette
Changes that require review have been detected!
Please refer to the table below for assigning reviewers and maintainers suggested by Danger in the specified category:
Category Reviewer Maintainer backend Felipe Artur ( @felipe_artur
) (UTC-3, 2 hours ahead of@digitalmoksha
)Peter Leitzen ( @splattael
) (UTC+2, 7 hours ahead of@digitalmoksha
)test for spec/features/*
Désirée Chevalier ( @dchevalier2
) (UTC-4, 1 hour ahead of@digitalmoksha
)Maintainer review is optional for test for spec/features/*
To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.
Once you've decided who will review this merge request, assign them as a reviewer! Danger does not automatically notify them for you.
If needed, you can retry the
danger-review
job that generated this comment.Generated by
Dangeradded 1 commit
-
d07867fe - Support
…
syntax for inline math in markdown
-
d07867fe - Support
- A deleted user
added documentation label
added 1 commit
-
c1917463 - Support
…
syntax for inline math in markdown
-
c1917463 - Support
- A deleted user
added featureaddition typefeature labels
added 869 commits
-
c1917463...1e538e53 - 868 commits from branch
master
-
a50d4969 - Support
…
syntax for inline math in markdown
-
c1917463...1e538e53 - 868 commits from branch
added 819 commits
-
a50d4969...c96cda2b - 818 commits from branch
master
-
67b6a34d - Support
…
syntax for inline math in markdown
-
a50d4969...c96cda2b - 818 commits from branch
added 374 commits
-
67b6a34d...8713f38b - 372 commits from branch
master
-
fa327ac4 - Support
…
syntax for inline math in markdown - 0e129772 - wip
-
67b6a34d...8713f38b - 372 commits from branch