hackmdio / hackmd-io-issues

Reporting issues about HackMD Enterprise Edition and HackMD.io
36 stars 8 forks source link

Syntax highlighting breaking #111

Closed ddejohn closed 5 years ago

ddejohn commented 5 years ago

Is this a hackmd.io issue?

What's the problem

Syntax highlighting breaks after using a LaTeX math block.

Current behaviour

Here is syntax highlighting working: https://i.imgur.com/mWrGcbO.png

Converting the inline math to a math block breaks the highlighting for the rest of the document: https://i.imgur.com/6FipNlv.png

See line 47 in the screenshots.

Steps to reproduce

  1. Put some markdown in your document.
  2. Put a math block (LaTeX between double dollar signs) before the markdown.
  3. Markdown syntax highlighting is broken.

I use HackMD on:

Desktop

It's not the end of the world, but when managing a large document, it is frustrating not having the visual aid for being able to find certain parts to edit.

jackycute commented 5 years ago

Hi @ddejohn, For inline math, the syntax is using single dollar sign to surround math. like:

$a = b + c$

For block math, the syntax is using double dollar sign and newlines to surround math. like:

$$
a = b + c
$$

So that the syntax highlighting will be rendered properly.

ddejohn commented 5 years ago

Weeelp I feel like an idiot.