Skip to content

Simple module for Python-Markdown which allows inserting text with custom class

License

Notifications You must be signed in to change notification settings

wilhelmer/mdx_custom_span_class

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Custom Span Class Markdown Extension

This is a simple extension for Python-Markdown library, which allows adding span elements with custom class.

The original version was developed by exaroth.

It was then improved by plugboy.

This version allows easier installation via pip install mdx-custom-span-class.

Syntax

The syntax is:

!!<class name>|<text to be wrapped>!!

For instance:

I love !!text-alert|spam!!

will return

<p>I love <span class="text-alert">spam</span></p>

Tip: If the | symbol causes conflicts with your Markdown tables, use ^ instead of |.

Installation

pip install mdx-custom-span-class

Usage

import markdown

md = markdown.Markdown(extensions=["custom-span-class"])
md.convert("I love !!text-danger|spam!!")

About

Simple module for Python-Markdown which allows inserting text with custom class

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%