Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown - adding classname to elements #403

Closed
vlos opened this issue May 20, 2017 · 3 comments
Closed

Markdown - adding classname to elements #403

vlos opened this issue May 20, 2017 · 3 comments

Comments

@vlos
Copy link

vlos commented May 20, 2017

I recently started playing with some markdown converters (nodejs) as I'm working on a GMing tool. To clean up the css and such I wanted to add class styles to blockquotes, specifically so I can create GM Note boxes and Description boxes easily.

Markdown Extra allows you to add "Id's" to elements and PHP markdown allows you to add classes. I grabbed the "Showdown.js" converter and with some simple reg-ex was able to add classnames to block quotes using the below syntax.

Just thought I would share as it may make it easier for your project to customize the markdown css as I know you are/were having problems with it.

I am looking to modify it a bit more to allow classes to be added to other elements as well.

Additional Details

Classname Appended to the first line of the start of a blockquote,

> some blockquote text {: classname}

As you can see by the screenshot below I can easily nest the boxes and other elements.

Example coding

@calculuschild calculuschild mentioned this issue Nov 6, 2020
46 tasks
@Gazook89
Copy link
Collaborator

I believe this is added to v3 with custom syntax. Particularly PR #1476 and curly injection.

@ericscheid
Copy link
Collaborator

ericscheid commented Aug 21, 2021

Curly-injection works to apply the {curly-items} into the preceding adjacent sibling element, not into the containing element.

Thus, an author could brew Hello **world**{color:red} and the <strong/> element gets injected.

That said, there is a suggested variation to {curly-inject} to target the containing element, specifically the <div class="page"> element that is wrapped around each page of content. #1489. Using a leading : or other symbol could be used to say "target containing element instead of preceding element".

@calculuschild
Copy link
Member

Added to the V3 changelog finally. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants