Start a new topic

Allow opting out of prose styles (allow class="not-prose")

Cohost uses tailwindcss-typography to provide default, mostly-sensible styling for posts. However there are situations where it might be nice to opt-out of this styling; for instance, the first and last <p> tag of a <blockquote> get quote marks added around them, and <code> tags get backticks surrounding them. These rules can't be overridden because inline styles cannot control the ::before and ::after pseudoelements.

tailwindcss-typography has a built-in opt-out for all of the added prose rules. Elements with the class "not-prose", and all their children, get opted out of (all? most?) of the CSS rules.

However the class attribute is stripped from elements. My suggestion is to allow the not-prose class to be used in the markdown filter.

(I had initially hoped that ~= meant "contains not-prose", so that you could allow classes as long as they had user-content- prepended to them like the id attribute. Alas. Alternately, I think the name of the selector is configurable.)

29 people like this idea

PLEASE. The backticks in particular really irk me. There have been times I've used explicit <code> tags and been aghast to find it inserting backticks where none were ever present.

2 people like this

 I actually originally came here to this forum today to find out if the backticks thing was a bug because I was certain I had not done anything wrong. I'm glad I checked the feature requests first. Yes, this is very annoying, I do not like the opinions of this CSS style to insert stuff I did not actually type. I would rather it be removed entirely than have it be something I can optionally disable, because it also happens in comments where your ability to control the presentation of what you write is much more limited.

One issue with allowing this element is that markdown such as links or emphasis is not parsed inside HTML, meaning that having to wrap everything in a div with not-prose all but defeats the purpose as you will have to type the HTML you would anyway, just with fewer style attributes. Perhaps this could be a user or post setting?

Login or Signup to post a comment