Css classes on any block


#1

I want to mark a paragraph with breakout, aside, a presenter’s note.

Is it possible to add a css class to a paragraph, link, image?

There is the ability for me to mark code with a programming language, and to add an hr to denote changing slides, but sometimes adding semantic meaning to a paragraph (via css classname) makes more sense.


The goal of good markup is let the author write with as little special markup as possible and not get bogged down in the details of the presentation layer. But you can not completely ignore the presentation format either. A slide deck, blog post, or book has different content. And sometimes a paragraph is an aside or summary.

I feel adding extra meaning (via “css classes”) would allow us to add semantic/micro-formats back to marked up documents, like John{:author} or James{:person}. This may introduce abuse ![image](image.jpg){:left} but not sure if that is so bad. I wonder if microformats have lost their luster because there is no good way to leverage them in a minimal markup language.

This is one thing I do like about word. While you can be focused on bold, you can also give a semantic label to paragraphs or spans. Disclaimer: I haven’t used word in over 10 years.

Look at LaTeX. It is so powerful because you can easily add semantic meaning to everything, and then post process for your particular use case. Very cool. Disclaimer: I’ve never used/liked LaTeX. But that is the reason Phd students tell me when I ask why they aren’t just using markdown.


This may be related to:
http://talk.commonmark.org/t/proposing-a-macro-standard-for-markdown/609


Consistent attribute syntax
Custom container for block and inline
#2

I agree and see the solution in a consistent attribute syntax, as already implemented partially by Pandoc and Markdown Extra.

A span could be done like this:

this is a [span]{.myClass} plus more inline content

While adding attributes to an entire paragraph is a bit more complicated (see the discussion in that thread) but could be something like:

paragraph
{.myClass}

I have put a draft together and made a pull request which currently includes the spans but not paragraphs.


#3

Thanks so much, looks like either macros or common attributes can meet my needs.

http://talk.commonmark.org/t/consistent-attribute-syntax/272/