Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
iconfonts.py
)Easily display icon fonts in python markdown. Just add the CSS necessary for your font and add this extension.
This is a 3rd party extension for Python Markdown. You can see a full list of 3rd party extensions here.
Although this works with any icon font, users can use a mod
syntax to add more prefixed classes to support Font Awesome and its special classes such as 2x, 3x, muted, spin, etc
Furthermore, users can add their own user_mod
syntax to add additional, non-prefixed, pre-defined classes for greater control over their icons while allowing you to control exactly what styles are allowed.
See the python markdown documentation for more information.
Use it in any personal or commercial project you want.
&entity_name;
&icon-html5;
&icon-css3;
&icon-my-icon;
Mod syntax:
&icon-html5:2x;
&icon-quote:3x,muted;
&icon-spinner:large,spin;
User mod syntax:
&icon-html5::red;
&icon-quote:2x:bold;
I love &icon-html5; and &icon-css3;
&icon-spinner:large,spin; Sorry we have to load...
I love <i aria-hidden="true" class="icon-html5"></i> and <i aria-hidden="true" class="icon-css3"></i>
<i aria-hidden="true" class="icon-spinner icon-large icon-spin"></i> Sorry we have to load...
pip install markdown-iconfonts
import markdown
md = markdown.Markdown(extensions=['iconfonts'])
or
import markdown
from iconfonts import IconFontsExtension
md = markdown.Markdown(extensions=[IconFontsExtension()])
base
option allows for use of Bootstrap 3 and FontAwesome 4 iconsmd = markdown.Markdown(extensions=['iconfonts'],
extension_configs={"base":"icon"})
converted_text = md.convert(text)
Input: &icon-html5;
Output: <i aria-hidden="true" class="icon icon-html5"></i>
prefix_base_pairs
optionThe prefix_base_pairs
option allows for multiple prefix-base pairs to be specified, to allow you to support both Bootstrap 3/Glyphicon and FontAwesome icons
md = markdown.Markdown(extensions=['iconfonts'],
extension_configs={
'iconfonts': {
'prefix_base_pairs': {
'fa-': 'fa',
'glyphicon-': 'glyphicon',
}
}
})
converted_text = md.convert(text)
Input: &glyphicon-remove; &fa-html5;
Output: <i aria-hidden="true" class="glyphicon glyphicon-remove"></i><i aria-hidden="true" class="fa fa-html5"></i>
Markdown
: pip install markdown
iconfonts.py
file into site-packages/markdown/extensions/
python unit-tests.py -v
FAQs
Easily display icon fonts in markdown.
We found that markdown-iconfonts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.