LaTeX code displays as italic between underscores in Markdown mode
See original GitHub issueThis is a very minor nuisance I have noticed while editing markdown cells in IPython Notebooks. The problem appears to also persist on the MarkDown Demo on CodeMirror’s site.
In Markdown, underscores toggle italics, but in LaTeX they also serve to indicate subscripts. Unfortunately, while editing with CodeMirror, underscores used in LaTeX mode sometimes cause italics to be toggled in the edit view.
Steps to reproduce:
- Start editing a markdown cell.
- Type the following: $$a_{n+1} = 2a_{n} + b$$
- The text will display as a__{n+1} = 2a__{n}+b` where the characters in bold here have been italicized in the editor.
Non-example:
- Enter the following into a Markdown cell: $$a_n = 2a_n+b$$
It appears that italics are ignored when there is a single alphanumeric character after the underscore, but the case in which the subscript consists of a bracketed group of characters is not handled correctly.
This is particularly annoying, because in italic monospaced fonts, pipes |
look like forward slashes /
and backslashes \
look like pipes |
.
Thanks!
PS: WIndows 7, 64-bit with Chrome, but I doubt it matters!
Issue Analytics
- State:
- Created 9 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
On Mon, Nov 24, 2014 at 2:24 PM, Marijn Haverbeke notifications@github.com wrote:
For what it is worth, here’s what I did for SageMathCloud (in coffeescript).
“gfm”), options…)
It’s really awesome how easy it is to do things like this using CodeMirror.
William
Professor of Mathematics University of Washington http://wstein.org
@williamstein A bug in your solution is if I type a
$
in a inline code or code block, it’ll be highlighted as TeX.like
See https://github.com/Moeditor/Moeditor/issues/5
Maybe we can find a way to set the “priority” of the marks?