fix inline/block math conflict

This commit is contained in:
Maxime Cannoodt 2022-06-25 11:15:57 +02:00
parent 9fccea6e3c
commit e9a4e2d3c7
2 changed files with 38 additions and 5 deletions

Binary file not shown.

View File

@ -83,8 +83,9 @@ const MathInline = {
},
tokenizer(src: string) {
const match = src.match(/^(\${1})((?:\\.|.)+)\1/);
const match = src.match(/^(\${1})((?:\\.|[^$])+)\1/);
if (match) {
console.log(src, match);
return {
type: 'math-inline',
raw: match[0],
@ -103,8 +104,7 @@ const MathBlock = {
},
tokenizer(src: string) {
// console.log(src);
const match = src.match(/^(\${2})((?:\\.|.|\n)+)\1/m);
const match = src.match(/^(\${2})((?:\\.|[^$]|\n)+)\1/);
if (match) {
console.log(src, match);
return {
@ -117,13 +117,46 @@ const MathBlock = {
}
};
// const MathInline = {
// name: 'math-block',
// level: 'inline',
// start(src: string) {
// return src.indexOf('$');
// },
// tokenizer(src: string) {
// // console.log(src);
// const match = src.match(/^(\${1,2})((?:\\.|[^$]|\n)+)\1/m);
// if (match) {
// console.log(src, match);
// if (match[1] == '$') {
// console.log('inline');
// return {
// type: 'math-inline',
// raw: match[0],
// text: match[2].trim()
// };
// } else if (match[1] == '$$') {
// console.log('block');
// return {
// type: 'math-block',
// raw: match[0],
// text: match[2].trim()
// };
// }
// }
// return false;
// }
// };
export default [
InternalLinkExtension,
InternalEmbedExtension,
TagExtension,
HighlightExtension,
MathInline,
MathBlock
MathBlock,
MathInline
];
// ^\#([\w\/]+)\W*