blob: 16af4fc32d872f1809f5da450a0c597e8a28c77f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
from markdown.extensions import Extension
from markdown.treeprocessors import Treeprocessor
class RemoveOuterP(Treeprocessor):
def run(self, root):
if len(root) == 1 and root[0].tag == "p":
root[0].tag = "span"
class InlineMarkdown(Extension):
def extendMarkdown(self, md, md_globals):
md.treeprocessors.add("remove_outer_p", RemoveOuterP(md), "_end")
|