Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

How to disable features (in particular auto-numbering of sections in TOC) ? #73

Open
sylvaticus opened this issue Apr 9, 2020 · 2 comments

Comments

@sylvaticus
Copy link

Hello, I just learned how to disable the latex plugin, but I would like now to also disable automatic numbering of paragraphs in the TOC, as they are already manually numbered.

More in general it would be nice to have a way to disable each feature individually and to document it.

@sylvaticus
Copy link
Author

I can see there in an option -h (I was looking for the manpage) that list the modules that can be disabled, including tableofcontent.

It would be nice to have an option to disable individual features for each module, e.g. -e tableofcontent numbers,links -e latexplugin equations

@sylvaticus
Copy link
Author

Solved my own user case with a bit of hacking of /usr/local/lib/python3.6/dist-packages/MarkdownPP/MarkdownPP.py

Now I have the sections with identation rather than numbering:

            if depth == 1:
                section = "%d\\. " % headernum
                sectionintoc = "- "
                sectioninbody = ""
                
            else:
                section = (".".join([str(x) for x in stack]) +
                           ".%d\\. " % headernum)
                sectionintoc = "".join("   " for x in stack)+"- "
                sectioninbody = ""

            #tocdata += ("%s [%s](#%s)  \n" %
            #            (section, TableOfContents.clean_title(title), short))
            tocdata += ("%s [%s](#%s)  \n" %
                        (sectionintoc, TableOfContents.clean_title(title), short))

            #transforms.append(Transform(linenum, "swap",
            #                  data[linenum].replace(title, section + title)))
            transforms.append(Transform(linenum, "swap",
                              data[linenum].replace(title, sectioninbody + title)))
            transforms.append(Transform(linenum, "prepend",
                              "<a name=\"%s\"></a>\n\n" % short))

Of course, the general idea to have feature disabled in the command line is still interesting..

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

No branches or pull requests

1 participant