Ask Your Question

How can I enable Python Code Highlighting in Askbot?

asked 2023-04-06 23:13:58 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2023-04-06 23:24:19 +0000

qstack gravatar image

updated 2023-04-07 18:16:33 +0000

Step 1: Put this in a file named in the project directory where you also find (Usually one level above the

import markdown 
class MyMarkdown(markdown2.Markdown):
     def init(self, args, *kwargs):
     extras = kwargs.get('extras', list())
     kwargs['extras'] = extras
     super(MyMarkdown, self).__init__(*args, **kwargs)

Step 2: Add this line to the settings py:

ASKBOT_MARKDOWN_CLASS = 'markdown_wrapper.MyMarkdown'

Restart the server. The code highlighting should work now (not in editing mode, but you will see it after the question was published.)

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer

Question Tools

1 follower


Asked: 2023-04-06 23:13:58 +0000

Seen: 878 times

Last updated: Apr 07 '23