Hi,

I'm trying to generate documentation that fits in with my company's
documentation standard, which requires:

<h1>Main title</h1>
<p>Some boring generated text</p>

<h2>Section1</h2>
<h2>Section 2</h2>
etc...


I can't see a way to generate the h1 and h2 headings from ReST but
insert the standard generated text into it (without having that text
repeated in every ReST file). Instead, I was trying to generate
everything from the <h2> onwards from ReST, and have the main title as
part of the layout.html (customisable from the project settings)

The problem I hit here is that the largest heading type in ReST is
automatically mapped to <h1>, whatever I do. This means that 'Section
1' always comes out as <h1>, but I need it to be <h2> in order to fit
with the style. Is there some way to control the way that ReST
headings are mapped to HTML?

It appears I can do this by creating a class that inherits from
HTMLTranslator, but it's not obvious how to customise visit_title
without more or less copying and pasting the implementation from the
parent class.

I see that one of the base classes (somewhere in docutils) has a
setting called initial_header_level, which seems like it might do what
I want. I can't find a way of passing this down without modifying the
sphinx code, however. In fact, I can't see how I'd have to modify the
code even if I were going to - it looks like I could add it to the
dictionary passed to process_programmatic_settings() in
StandaloneHTMLBuilder.render_partial(), but it didn't seem to work for
me.

Has anyone tried to do this before? Am I missing something obvious?

Tim

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to