Before I used the MARKDOWN2, not why, casually picked, the last two days I raised a question in Segmentfault: What is the difference between markdown and Markdown2 in Python? , it is said Misaka quickly, because is CPython, tried, not too much feeling, I want is simple, performance has not been considered in the interim.
By markdown the extension to del out of the specified syntax on the line, as follows:
The code is as follows |
Copy Code |
Import Markdown Class Mymarkdownextension (markdown. Extension): def extendmarkdown (self, MD, md_globals): Del md.parser.blockprocessors[' Hashheader '] My_markdown_extension = Mymarkdownextension () Raw_text = ' #this H1 ~ ~ ~ ~ Print Markdown.markdown (Raw_text, [my_markdown_extension], Safe_mode = ' escape ') |
Output <p> #this H1 ~~~</p>, this is the effect, of course, there are other can be deleted.
Here is the key that all Md.inlinepatterns contains:
code is as follows |
copy code |
' Backtick ' ' Escape ' ' reference ' ' link ' ' image_link ' ' image_reference ' ' short_reference ' ' autolink ' ' Automail ' ' linebreak2 ' ' linebreak ' ' html ' ' entity ' ' Not_strong ' ' strong_em ' ' strong ' ' Emphasis ' ' emphasis2 ' If what you want is not on top, look at the md.parser.blockprocessors: ' indent ' ' code ' ' Hashheader ' ' setextheader ' ' hr ' ' olist ' ' ulist ' ' quote ' ' paragraph ' |