Description
Hey party people!
I'm working on a project that parses all the markdown files in the doc directory of this repo, and I've come across a number of instances of inconsistent naming of the plaintext info string (i.e. the language) in GitHub Flavored Markdown code fencing:
language | instances |
---|---|
text |
44 |
txt |
21 |
fundamental |
1 |
markdown |
1 |
raw |
1 |
I'm currently using this hack to sanitize all the incoming markdown before converting it to HTML:
markdown = markdown
.replace(/```txt/gm, '```plaintext')
.replace(/```text/gm, '```plaintext')
.replace(/```fundamental/gm, '```plaintext')
.replace(/```raw/gm, '```plaintext')
.replace(/```markdown<.*$/gm, '```plaintext')
.replace(/```plaintext<.*$/gm, '```plaintext')
Here's what the current documentation style guide says about code blocks:
- For code blocks:
- Use language aware fences. ("```js")
- Code need not be complete. Treat code blocks as an illustration or aid to
your point, not as complete running programs. If a complete running program
is necessary, include it as an asset inassets/code-examples
and link to
it.
There's no mention of what the canonical language should be for plaintext, but I'd suggest standardizing on one of the following:
text
is the most commonly used plaintext info string in this projectplaintext
is what the popular highlight.js syntax highlighting library expects
I don't have a strong opinion about what the info string should be as long as it's used consistently across the docs. I'd be happy to open a pull request to clean these up, but wanted to open an issue first for discussion.
Things that might need to be done to resolve this:
- Choose an info string for plain text
- Update docs to all use the same info string
- Update the style guide
- Add a linting rule?
- What else?
cc @nodejs/documentation 👋