-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for \[ and \] math blocks #13
base: master
Are you sure you want to change the base?
Conversation
When copy pasting text from/to latex, one of the main pain is to change all $$ ... $$ blocks to \[ ... \]
@@ -106,18 +106,24 @@ function math_block(state, start, end, silent){ | |||
max = state.eMarks[start] | |||
|
|||
if(pos + 2 > max){ return false; } | |||
if(state.src.slice(pos,pos+2)!=='$$'){ return false; } | |||
|
|||
/** @type {readonly ['$$', '\\['} */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are type annotations accepted? Should I remove them?
lastPos = state.src.slice(0,max).lastIndexOf('$$'); | ||
lastLine = state.src.slice(pos,lastPos); | ||
found = true; | ||
for (const delim of rightDelimiters) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the usage of for-of prohibited for browser compat?
@@ -148,7 +156,7 @@ function math_block(state, start, end, silent){ | |||
+ state.getLines(start + 1, next, state.tShift[start], true) | |||
+ (lastLine && lastLine.trim() ? lastLine : ''); | |||
token.map = [ start, state.line ]; | |||
token.markup = '$$'; | |||
token.markup = startDelim; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens to the token markup when the start and end character isn't the same. Is it even supported?
Note that this coding style is quite foreign to me, so I hope I have put the spaces where needed. |
Fix nested begin/end for inline bare block
When copy pasting text from/to latex, one of the main pain is to change all $$ ... $$ blocks to [ ... ]
Not that although I opened this PR, there are a few questions and things to resolve before it can be merged.
I'll leave them as comments and mark the pr as draft for now.