or
Adám
feature-request wont-fix
Pandoc's markdown allows:
```markdown
:::classname
content
:::
```
which renders as
```html
<div class="classname">
<p>content</p>
</div>
```
We could selectively allow custom CSS by allowing the `:::` fence syntax and creating class names for selected white-listed CSS, e.g.
```css
font-face\3A monospace {
  font-family: monospace;
}
```
so we can write:
```markdown
:::font-family:monospace
content
:::
```
Then we can always add more CSS-rule classes later.

**Note:** Do *not* allow arbitrary CSS, as that can be dangerous to users.
Top Answer
Jack Douglas
I'm marking this as `wont-fix` because it is (too) generic — we'll consider requests for markdown plugins that serve a specific need (such as monospace perhaps) but I don't think there needs to be a generic implementation like this.

So we might add something like:

```
:::monospace
content
:::
```

but not 
```
:::font-family:monospace
content
:::
```

> Then we can always add more CSS-rule classes later.

adding plugins is relatively trivial from a code perspective, so that side of things isn't an issue. We just want to be very careful we are sure they meet a specific need first, because removing them isn't so straightforward once they are in use, and each one will add it's own maintenance burden.
Answer #2
David
I really like this idea. I see that it originated in the discussion over whether tables should have [proportional or monospaced fonts][1], but the potential use-cases go beyond anticipating custom CSS.

There is, I *think*, a [Markdown-it plugin][2] which provides this functionality: `markdown-it-container-pandoc`.

**Backstory**: the site on which I was most active on the SE network often involved long essays as answers (sometimes as questions!) and often enough I wished I could add "id" to my headings to function as inner-links. TA already generates an ID based on any `<h*>...</h*>` text, but that could be quite cumbersome (almost inevitably spaces are involved which require `%20` in the link). But something like:

```markdown
::: {#myhead3}
## My subheading in a very long essay
:::
```

Would provide:

```html
<div id="myhead3">
<h2 id="all_the_TA_stuff_here">My subheading in a very long essay</h2>
</div>
```

which I think would be great. There may well be drawbacks I'm missing (e.g. is this the "arbitrary CSS" that Adám's warned about at the end of his question?), but meanwhile ... yes, please!

[1]: https://topanswers.xyz/meta?q=646
[2]: https://www.npmjs.com/package/markdown-it-container-pandoc?activeTab=readme
Add custom classes for specific CSS
David
Ah, so I'm guessing "prefixed" to avoid clashes? I guess there isn't a way that avoids used "view source" to be sure of the ID, but if one wants these things, that's a small "price" to pay!
David replying to Jack Douglas
THIS would be cool B-) but I'm not 100% clear on what the suggestion is. If I knew ... it might be even more appealing that auto-inserting `%20`s!
David replying to Jack Douglas
"`...we could consider changing the format of the links ie replacing spaces with %20 automatically if that would help?`" Absolutely it would. I longed for this sort of thing back in the day. And if one knew this was a "feature" of the site, one could always tailor one's `<h3>...</h3>`'s, etc., accordingly. Should I make a new Q&A to track this (I mean, just for automatically encoding spaces in heading IDs to `%20`)?
Jack Douglas
or possibly even allow user-specified ids and prefix them
Jack Douglas replying to David
not at all — I think your answer here is really a different feature request and not generic. The auto-generated links do need to be guaranteed unique across a question and its answers (or another answer might clash), so allowing arbitrary ids isn't possible, but we could consider changing the format of the links ie replacing spaces with %20 automatically if that would help?
David
@Jack I won't ask whether you laughed or cried when you saw my feeble input. :| Ah well! For my "use case", there is always that auto-generated ID with the headings. And for that, I am truly grateful.
Adám replying to David
that'd require restricting the allowed attributes, but one of the attributes that'd need restricting is `style`, which then defeats the whole purpose.
David replying to Adám
Ah. Right. There must be a way to sanitze, no?
Adám
@David That's *even more* dangerous than arbitrary CSS:  
```markdown  
::: {onload="malicious JS which asks for your credentials and sends to me"}  
innocent-looking content  
:::  
```  
[Renders as](https://pandoc.org/try/?text=%3A%3A%3A+%7Bonload%3D%22malicious+JS+which+asks+for+your+credentials+and+sends+to+me%22%7D++%0Ainnocent-looking+content++%0A%3A%3A%3A++&from=markdown&to=html5):  
```html  
<div onload="malicious JS which asks for your credentials and sends to me">
<p>innocent-looking content</p>
</div>  
```