Home / GitHub Page

Feature request: Direct addressing of classes etc. by Markdown

How to render ChiliPepper without using HTML tags?
It would be nice if Markdown could address classes, IDs and properties directly. Something like this:

... [chili pepper]{.hot} ... by class
... [chili pepper]{#hot} ... by ID
... [chili pepper]{{color: red; font-weight: bolder;}} ... by direct style specs


... <span class="hot">chili pepper</span> ... by class
... <span id="hot">chili pepper</span> ... by ID
... <span style="color: red; font-weight: bolder;">chili pepper</span> ... by direct style specs

This syntax was inspired by PHP Markdown Extra.

It would be even nicer if modifiers could be combined in one expression:

... [chili pepper]{.hot .boxed #lot20137 {font-variant: small-caps;}} ... by enumeration

to be interpreted as:

... [[[[chili pepper]{{font-variant: small-caps;}}]{#lot20137}]{.boxed}]{.hot} ... by enumeration

thus giving nested span elements:

... <span class="hot"><span class="boxed"><span id="lot20137"><span style="font-variant: small-caps;">chili pepper</span></span></span></span> ... by enumeration

Something for a new plug-in?

For the time being I use false tags to work around the verbose span tags:

... <hot->chili pepper</hot-> ... by false tags

in combination with the CSS rule:

hot- { color: red; font-weight: bolder; }

I don’t expect the W3C Police will knock on my door for this, but somehow it feels as an improper use of HTML tags. And I still have to express twice that I want to have it hot, once at the beginning and once at the end of the phrase.

These false tags are pretty cool albeit less readable than the markdown extra syntax.

What would make it super useful for me would be the ability to assign keyboard shortcuts to different styles. So for example if I can type Ctrl+1 similar to how Ctrl+B works for bold, and instead of wrapping it in bold markdown, it wraps it in [text]{.style1} markdown or something like that.

Generally in my notetaking style, I just need a bit more than bold and italic to pull out different bits of text.