mdn / stumptown-content

Other
23 stars 19 forks source link

Catch invalid "code syntax highlighting markers" #122

Open peterbe opened 5 years ago

peterbe commented 5 years ago

It's hard to link to a specific line in markdown files in GitHub: https://github.com/mdn/stumptown-content/blob/master/content/html/reference/elements/abbr/docs.md#accessibility-concerns You have to click to view Raw to see what I'm talking about:

``` {.brush: .html}
<p>JavaScript Object Notation (<abbr>JSON</abbr>) is a lightweight data-interchange format.</p>
```

What it should be is:

```html
<p>JavaScript Object Notation (<abbr>JSON</abbr>) is a lightweight data-interchange format.</p>
```

I think this {.brush: .html} is a relic from the Kuma wiki raw content.

This'll happen from time to time and it barfs up the renderer's ability to syntax highlight. The renderer will need to decide that to do if the string there isn't html or css or wasm or something else it can expect.

I thing the best course of action for the renderer is to swallow all such troublemakers, make a console warning, and leave it be. Ideally, in the linters here on the content side, it should clean throw an error.

peterbe commented 5 years ago

I'd love to help with this one. Can someone guide me on how to hook up into the markdown conversion so as to write some code that validates?