Change math syntax (#3280)
This commit is contained in:
parent
cb0874f15a
commit
3fc70996e2
@ -9,7 +9,7 @@ export type TextElementMath = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function(text: string) {
|
export default function(text: string) {
|
||||||
const match = text.match(/^\$(.+?)\$/);
|
const match = text.match(/^\\\((.+?)\\\)/);
|
||||||
if (!match) return null;
|
if (!match) return null;
|
||||||
const math = match[0];
|
const math = match[0];
|
||||||
return {
|
return {
|
||||||
|
@ -266,7 +266,7 @@ describe('Text', () => {
|
|||||||
|
|
||||||
it('math', () => {
|
it('math', () => {
|
||||||
const fomula = 'x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}.';
|
const fomula = 'x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}.';
|
||||||
const text = `$${fomula}$`;
|
const text = `\\(${fomula}\\)`;
|
||||||
const tokens = analyze(text);
|
const tokens = analyze(text);
|
||||||
assert.deepEqual([
|
assert.deepEqual([
|
||||||
{ type: 'math', content: text, formula: fomula }
|
{ type: 'math', content: text, formula: fomula }
|
||||||
|
Loading…
Reference in New Issue
Block a user