Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Section numbers not getting excluded from generated headings #42

Open
nihalshah-dev opened this issue Aug 8, 2024 · 0 comments
Open

Comments

@nihalshah-dev
Copy link

nihalshah-dev commented Aug 8, 2024

Hello @timvink ,

In continuation to this - #37 (comment) & #37

I needed to exclude section numbers from generated headings. After some investigation, I would like to propose some modifications to the plugin to allow users to control whether section numbers are included in headings.

CHANGE -->

heading.py -

def enumerate(self, add_section_number=True, add_span_element=False):
        if add_section_number:
            section_string = self.section_number_string()
            self.heading.insert(0, " ")

This new configuration option "add_section_numbers", which defaults to True. When set to False, this option excludes section numbers from generated headings.

plugin.py (CURRENT) -

image

plugin.py (NEW) -

class EnumerateHeadingsPlugin(BasePlugin):
    config_scheme = (
        ("strict", config_options.Type(bool, default=True)),
        ("toc_depth", config_options.Type(int, default=0)),
        ("increment_across_pages", config_options.Type(bool, default=True)),
        ("restart_increment_after", config_options.Type(list, default=[])),
        ("include", config_options.Type(list, default=["*"])),
        ("exclude", config_options.Type(list, default=[])),
        ("add_section_numbers", config_options.Type(bool, default=True)),  # New option
    )

Let me know what do you think about this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant