2

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 default, there is h1 the first heading. I need to have h2 as the first. Exists any way to do this?

Thanks.

yetty
  • 2,326
  • 2
  • 19
  • 22
  • I don't really understand your question. What do you want to do with the first heading? – Zhehao Mao Jul 08 '11 at 14:19
  • I have h1 already on the page. But the content is separated and I don't want to repeat h1 heading and I want to start with h2. – yetty Jul 08 '11 at 14:22
  • UPDATE: I am sorry, I had h1 and h2 tags in the question and they are hidden now. – yetty Jul 08 '11 at 14:23
  • me too. What do you mean by 'top/first heading'? Those three have heading/header support (click on the links on that page) – kusut Jul 08 '11 at 14:23
  • I *think* he wants to change the level of the H tag so that what would normally be an H1 becomes an H2, etc. – Peter Rowell Jul 08 '11 at 14:32

1 Answers1

1

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.

Zhehao Mao
  • 1,789
  • 13
  • 13