Django: markup - set the top heading
I am choosing between markup languages mentioned on https://docs.djangoproject.com/en/dev/ref/contrib/markup/ .
But I need one specific thing - set the top heading. By d开发者_高级运维efault, there is h1 the first heading. I need to have h2 as the first. Exists any way to do this?
Thanks.
If you are using markdown, you explicitly denote the heading levels. For instance
# Heading 1
## Heading 2
corresponds to
<h1>Heading 1</h1>
<h2>Heading 2</h2>
If you want to start with heading two, just make sure to use ## everywhere you would overwise use #.
If you want to have this done automatically, I suppose you could have a filter like
re.sub('#+', lambda m: m.group()+'#', text)
to shift all the headings down one level before passing it into markdown.
精彩评论