jonschlinkert / sublime-markdown-extended

Top 100 Sublime Text plugin! Markdown syntax highlighter for Sublime Text, with extended support for GFM fenced code blocks, with language-specific syntax highlighting. YAML Front Matter. Works with ST2/ST3. Goes great with Assemble.
https://github.com/jonschlinkert
MIT License
660 stars 96 forks source link

Syntax highlighting breaks specifically with 3 dashes #37

Closed gilbert closed 10 years ago

gilbert commented 10 years ago

Take the following markdown:


---
## Smaller Header

```javascript
var add = function (a, b) {
  return a + b;
};
```\

Ignore the backslash, that's only there so I can type the example into this issue

With three dashes --- for an hr, the code block no longer has correct syntax. However, with 4+ dashes, the code block works fine.

Adding another set of three dashes seems to "undo" the problem:


---
## Smaller Header

```javascript
var add = function (a, b) {
  return a + b;
};
```\

---

```javascript
var multiply = function (a, b) {
  return a * b;
};
```\

Is the plugin perhaps trying to use three dashes as some kind of block?

jonschlinkert commented 10 years ago

You can get around it by using one of the other accepted formats. The root of the problem is YAML highlighting:

---
foo: bar
---

There might be a way to prevent this problem, but I'm not sure the complexity would be worth it given the other options for horizontal rules. But I'd be happy to merge some thing in or make the changes myself if you have any suggestions

gilbert commented 10 years ago

Ah, yaml, so it's like that for front matter, basically. That makes sense. Thanks for the reply!