frostming / marko

A markdown parser with high extensibility.

Home Page:https://marko-py.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CSS / Styling

mfhepp opened this issue · comments

If the resulting HTML is to be used within a larger Web site, it would often be very useful to be able to attach CSS class information and IDs to standard HTML elements, like h1, all headers, body text, etc.

Is there any recommended way of doing this with Marko?

Of course, I could implement this in a post-processing step, e.g. taking the resulting HTML DOM and applying some transformations, e.g. with BeautifulSoup at the HTML DOM level.

But being able to set CSS classes and IDs for the most popular HTML elements in the output would be very useful!

Sorry for the late reply, it is like an extensive Markdown format. You can make use of the powerful extension system of Marko to achieve this.

You should first design the syntax rule to inject css classes, a possible syntax can be:

.red[# Heading1]

which is rendered as:

<h1 class="red">Heading1</h1>

Should you encounter any problems, I can offer help in any forms.

It is rather a customize extension than an issue of Marko, close it now.