Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6166041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:16:17+00:00 2026-05-23T22:16:17+00:00

In the HTML output generated by rst2html, sections at all levels are all with

  • 0

In the HTML output generated by rst2html, sections at all levels are all with class "section". Can I config it?

Thus, if I want apply my own CSS to the HTML output, I just can not use different styles for top-level section and sub-section, because they have the same class name?

How to solve this problem if I want to apply different styles to sections at different level?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:16:18+00:00Added an answer on May 23, 2026 at 10:16 pm

    I have solved this problem by writing my own rst writer class Inheriting docutils.writers.html4css1.Writer, and in its constructor, assign it a instance of class HTMLTranslator Inheriting docutils.writers.html4css1.HTMLTranslator to its translator_class attribute.

    Specifically, in my HTMLTranslator class, the method visit_section is overridden::

    def visit_section(self, node):
        self.section_level += 1
        self.body.append(
            self.starttag(node, 'div', CLASS='section section%d' % self.section_level))
    

    Thus, section at level 2 will get a class section section2.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I omit all XML-Namespaces from the xslt in the html-output? My XSL
I've noticed that the wmd editor can either output HTML or markdown. Does it
I want to avoid the duplication of stylesheet link tags in the output html
I'm trying to use XSL-stylesheets in order to transform some generated XML-data to HTML-output.
i used rows.xml() to generate html output. i want to know how to add
i need to change the automatically generated index.html flex output to admin.anotherExtension. I understand
Is the html output generated in ASP.Net 4.0 is HTML5 Compliant?
I need to theme my lightbox. I can see the HTML generated by the
Some web page's dom is generated dynamically by Javascript, any tool can output the
I frequently use HTML output in applications, up to now I've used some simple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.