Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 997
Timmy Avatar asked Oct 13 '10 16:10

Timmy


People also ask

How do you get syntax highlighting for Markdown?

Many Markdown processors support syntax highlighting for fenced code blocks. This feature allows you to add color highlighting for whatever language your code was written in. To add syntax highlighting, specify a language next to the backticks before the fenced code block.

How do I put HTML code in Markdown?

in HTML will appear as <div class=Heading 1> Markdown also allows for raw HTML. There is no need to put any syntax around the code, but it needs to stand alone in the source document with no content above or below. A good example of using raw HTML in a Markdown document is when embedding a Youtube video.

How do I insert a code block in Markdown?

Code Blocks To produce a code block in Markdown, simply indent every line of the block by at least 4 spaces or 1 tab. For example, given this input: This is a normal paragraph: This is a code block. A code block continues until it reaches a line that is not indented (or the end of the article).

How do I use Python code in Markdown?

To add a Python code chunk to an R Markdown document, you can use the chunk header ```{python} , e.g., ```{python} print("Hello Python!") ```


1 Answers

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.

like image 61
kindall Avatar answered Sep 16 '22 16:09

kindall