Code Monkey home page Code Monkey logo

mkdocs-add-number-plugin's People

Contributors

ignorantshr avatar timvink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mkdocs-add-number-plugin's Issues

excludes parameter not working

I tried setting:

- mkdocs-add-number-plugin:
    excludes: 
        - TMD/

But all the files is the folder still have the heading numbers added.

Did this functionality work for you?

I could submit another PR to fix it (after first finishing #4)

Add numbering to page headings

Hi @ignorantshr, thanks for the plugin! I was actually thinking of building the exact same thing, but found yours!

I'd like to add numbering not only to the table of contents, but also to the headings in the page itself. Like so:

Could this be added? I'm also prepared to provide a PR if you want.

Fix sequential headers when using multiple h1 in one page

When within one page you have multiple headers, you need to account for that in the sequential pages.

# Header 1 page 1
# Second Heading 1 page 2
# Header 1 page 2

Will render as

# 1. Header 1 page 1
# 2. Second Heading 1 page 2
# 2. Header 1 page 2

But "2. Header 1 page 2" Should be "3. Header 1 page 2"

I have not implemented that logic yet..

Update README

I noticed you wrote

The following is an English description that using Google Translate

If you want I can help write a nice README.md in English?

Potential fork

Hi @ignorantshr ,

So I found some time to continue work on this. I ended up rewriting the entire plugin to fit my own needs and making some different choices like:

  • Start heading numbers at 0 until a heading 1 is encountered. This removes the need for strict
  • Drop include and exclude
  • Drop increment_pages (always use this)
  • Drop order
  • Add <span> elements around numbers for CSS styling
  • Add large unit tests and CI

I would also like to publish my plugin and call mkdocs-enumerate-headings-plugin (I think the name better reflects the functionality). I wanted to check first if you would be OK with that?

Sequential numbering between pages

Hi @ignorantshr,

My team uses MkDocs to both publish a site and export a report as PDF (using mkdocs-pdf-export-plugin).

I would like to have the numbering increment for each main page. That way, you can refer to specific sections in the PDF report.

Happy to work on a PR if you're interested in adding this feature?

Add entrypoint for `add-number`

MkDocs plugin have the naming convention mkdocs-<name>-plugin but for entrypoint, leave out the "mkdocs-" and "-plugin".

We can add another entrypoint to setup.py, e.g. from:

    entry_points={
        'mkdocs.plugins': [
            'mkdocs-add-number-plugin=mkdocs_add_number_plugin.plugin:AddIndexPlugin'
        ]
    }

to:

    entry_points={
        'mkdocs.plugins': [
            'mkdocs-add-number-plugin=mkdocs_add_number_plugin.plugin:AddIndexPlugin',
            'add-number=mkdocs_add_number_plugin.plugin:AddIndexPlugin'
        ]
    }

And then update the README.md appriopriately.

increment_topnav does not work

Hi, i need the configuration option "increment_topnav", but still get an error.

mkdocs.yml:

site_name: GitLab MkDocs Example

plugins:
  - add-number:
      increment_topnav: True

error:

~\AppData\Roaming\Python\Python39\site-packages\mkdocs_add_number_plugin\plugin.py", line 51, in on_nav nav.items[index].title = str(index + 1) + '. ' + \ TypeError: can only concatenate str (not "NoneType") to str

add number to the link to heading

When we write markdown file, someone want to use link to a heading like:

refer to [section a](#section-a)

## section a
foo bar

This plugin will update the heading and add number, but it will not update the link to the heading.
Therefore, the link will be a dead link.
(In above example, ## section a will be ## 1. section a, but the link to this heading [section a](#section-a) will not be updated.)

Is it possible to update the link automatically?

heading 2 becomes heading 1

While writing unit tests, I noticed that:

# one
### two
## three

Will lead to ## three becoming a <h1>. (see screenshot below).

Is that intended behaviour? I have not enabled strict_mode.

imageimage

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.