MadLittleMods / markdown-icons

Easily display icon fonts in markdown.
Other
13 stars 12 forks source link

Compatibility with semantic ui #13

Closed rokdd closed 3 years ago

rokdd commented 3 years ago

I love to use semantic / formantic ui icons. How I can use them with your syntax: <i class="big icon external alternate"></i>

The icon as a base I understand, but how to get rid of the prefix, when it comes from the markdown? And what is even with the space? From the manuals I see here it should be the markdown for the example above: &icon-external alternate;

I could only imagine to put a underscore and replace it with a space later? But I do not want to mess up the concept of this little nice extension..

MadLittleMods commented 3 years ago

There is a section in the readme about running it without a prefix, see https://github.com/MadLittleMods/markdown-icons#no-prefix-just-in-case-you-couldnt-figure-it-out-p

Might not be the greatest for Semantic UI though.

rokdd commented 3 years ago

To be honest it does not really help, or I am wrong. Because the classname does not strip the icon- (and the problem with the whitespace): Input: &icon-wrench; Output: <i aria-hidden="true" class="icon wrench"></i>

What already works (with base="icon"): Input: &wrench; Output: <i aria-hidden="true" class="icon wrench"></i>

MadLittleMods commented 3 years ago

It looks like got it working with your second example.

Copy pasting the markup from https://semantic-ui.com/elements/icon.html#/definition, here is an expected:

<i class="massive home icon"></i>

It seems like you could achieve this by:

md = markdown.Markdown(extensions=['iconfonts(prefix=, base=icon)'])
converted_text = md.convert(text)

Input:

&home:massive;

Output: haven't tested

rokdd commented 3 years ago

That works, even when it is not perfect. Thank you.