Hey, I’m pretty psyched about the idea proposed here to do a BBCode block.
It made me think of something else though, that I want to float here to see what folks think.
I’m wondering if this is an opportunity to actually improve commonmark itself to support directives within a document for different rendering options.
There were some hints of exploring an idea like this in a few posts in this topic on the commonmark forum. For example:
The current spec says “A renderer may also provide an option to render soft line breaks as hard line breaks.”, which I take to mean that a rendere might have an option, like a commandline or configuration option, to render hardbreaks instead of softbreaks. Even though this seems like a solution, it’s not, due to lack of granularity.
More specifically, this would mean you could turn this option on or off for a single user or perhaps even system. However, a single user might have different needs in different documents and, as shown above, even different needs within a document.
If we could somehow detect between the different types of “paragraphs” (or rather, distinguish between a paragraph and a group of lines) without adding markupt for that this would be great. Comment #41 has a proposal for this, but I simply don’t think we can come up with something that works in enough cases, so the second-best option would be to somehow mark a single paragraph, or a block of markdown, to use hard-rendered linebreaks?
I’m thinking about something along the lines of the ``` syntax that can be prefixed and postfixed to a list of blocks to make linebreaks inside them rendered hard.
In many ways, what we’re proposing here is exactly that. Within Discourse, BBCode blocks work well already for things like [details="foo"]
. Maybe that’s the easiest place to start here.
But I’m also wondering whether there’s something more generic here as feedback/input we can provide upstream to commonmark to allow for blocks within a doc to use different rendering options. Do you think it’s worth exploring that further as well?