Comments (5)
I really hoped I chose the right repo to open the issue on 🤦♀️
Interesting, I've hoped that it could become part of the parser, but I do agree that adding features just because some company made up their own syntax is far from the optimal solution.
I did want to keep the backticks in the docs, but just remove them when I deploy Docusaurus to GitLab pages, so manual replace wouldn't work here. I think adding it to the tree parsing is trivial, since syntax here is very deterministic, so I think a simple regex will do for me. I believe we can close this issue then!
Just as a note for people who might need to do a similar thing, this is the replace
function regex I used to successfully replace backticks in my project. I've put this into .js
file and I'm just running it in CI as an npm script before building the site, so the changes are not committed into the repo itself, and still editable on Gitlab.
.replace(/\$+[^`$]{0,1}\`([^\$]+)\`[^`$]{0,1}\$+/gim, "$$$1$$")
from mdast-util-math.
@github-actions Common agreement was reached.
from mdast-util-math.
Hey
Parsing is done by micromark: https://github.com/micromark/micromark-extension-math. This project deals with ASTs. It’s a bridge between the tokens that micromark emits and mdast.
GitLab math is not a priority to me. There is no math in markdown spec. And the one they use is rather different from some of the others (around backticks but also for in the “block” form). I believe that it is bad for markdown that products dreams up their own markdown extensions and I don’t think it’s manageable for me to reverse-engineer whatever they came up with.
If you want to support GitLab math, and “support” for you here means:
a) Remove the backticks
(potentially: b) Add support for block math)
Then you can do it at the tree level:
import {visit} from 'unist-util-visit'
/** @type {import('unified').Plugin<Array<void>, import('mdast').Root, import('mdast').Root>} */
export default function remarkMathGitLab() {
return function (tree) {
visit(tree, (node, index, parent) => {
if (node.type === 'inlineMath') {
node.value = node.value.replace(/^`|`$/g, '')
}
if (node.type === 'code' && node.lang === 'math') {
parent.children[index] = {
type: 'math',
value: node.value
}
}
})
}
}
from mdast-util-math.
Hi! This was closed. Team: If this was fixed, please add phase/solved
. Otherwise, please add one of the no/*
labels.
from mdast-util-math.
Hi team! Could you describe why this has been marked as wontfix?
Thanks,
— bb
from mdast-util-math.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mdast-util-math.