Support for Classes on All Tag Types
Can we add classes to tags other than Heading? I couldn't find a solution for this. It might be useful to do so in cases like adding dir=auto to the classes of Tag::Paragraph or Tag::List. I might be missing a better approach.
Currently, I am achieving this for Tag::Heading using the following code:
let parser = Parser::new_ext(markdown_input, options).map(|event| match event {
Event::Start(mut tag) => {
if let Tag::Heading { classes, .. } = &mut tag {
classes.push("dir=auto".into());
}
Event::Start(tag)
}
_ => event,
});
Can we do this in other ways that I might not be aware of, which might be applicable to Tag::Paragraph and others too?
I think their implementation goes a bit too far, but something like this would be ideal for all some elements. My use case (currently achieved by a pretty nasty custom iterator) is for adding data attributes like [foo](https://my-link){: data-baz='bar' }
Another piece of prior art would be Pandoc's attributes extension, which reuses the header attribute syntax that pulldown-cmark already supports (# asdf {.foo}), so <a href="foo" class="bar">baz</a> would be [baz](foo){.bar}.