timvink/mkdocs-enumerate-headings-plugin

Numbers getting displayed at the links

Opened this issue · 4 comments

Hi @timvink,

I hope you still support the plugin, we are using the plugin for autonumbering the headings and we are facing the below issue in our pages.

image

In the image, Instead of 1.4.4 SimpleTags / 1.4.5 StructuredTags only SimpleTags / StructuredTags should be displayed. Numbers are not expected to be displayed automatically before the links.

Do we have any work around for avoiding this kind of issue. Please suggest.

Thanks

Interesting. Can you post the source markdown? Then I can try to reproduce

Same issue here (version 0.6.1 of the plugin).

See [next section](#entropy) for more details.

## Entropy

This is a new section.

is rendered as "See 2.1 next section for more details." assuming the numbering for the section on entropy is 2.1.

Interestingly, the text is rendered as expected if using See [next section](regressor.md#entropy) for more details where regressor.md is the name of the file.

Using mkdocs-material 9.4.6.

@timvink any updates on this issue?

here's a part of my markdown, in case you need it -

Markdown -

image

Output -

1.4.4 SimpleTag

Class SimpleTag is a 1.4.3 Tag representing exactly one 1.4.8 TagValue. The value data type can be any of the data types as defined in Data types.

Thanks!

Hello @timvink ,

In continuation to this - #37 (comment)

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!