Timmy
Timmy

Reputation: 12828

Markdown with custom syntax?

I'm using python and using markdown. Is there a simple way to add a custom syntax? I want something like [ABC] expands to a certain tag or something.

or do I use regex?

Upvotes: 8

Views: 6166

Answers (1)

kindall
kindall

Reputation: 184200

It appears that you can write extensions for Python-Markdown, which is probably the best approach.

If you are using some other Markdown implementation (or, you know, just for the heck of it) you could pre-process the text to implement your own tags (converting them to HTML) before handing it off to Markdown. This could be done using a regex or by any method you like. Within reasonable limits, Markdown should leave your HTML alone.

Upvotes: 4

Related Questions