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

feat(toc_obj): Support unnumbered headings #269

Merged
merged 5 commits into from Jan 29, 2022
Merged

Conversation

Cerallin
Copy link
Contributor

This PR adds a feature for unnumbered headings.

  1. The user specifies unnumbered_class_list and passes it to tocObj.
  2. Headings WITHOUT classes in unnumbered_class_list will be parsed as usual.
  3. Headings WITH classes in unnumbered_class_list will be parsed with unnumbered: true.

As is provided in test/toc_obj.spec.js, I have made minimized modifications as much as possible.

P.S. Maybe unnumbered_class_list is too long?

lib/toc_obj.js Outdated Show resolved Hide resolved
lib/toc_obj.js Outdated Show resolved Hide resolved
lib/toc_obj.js Outdated Show resolved Hide resolved
Copy link
Member

@yoshinorin yoshinorin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Cerallin
Would you please update README?

https://github.com/hexojs/hexo-util/tree/ab5ad9dd906f865faeba846b92be9dcce8c27120#tocobjstr-options

P.S: no need force-push. we will squash-merge.

README.md Outdated Show resolved Hide resolved
Copy link
Member

@yoshinorin yoshinorin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Cerallin
Would you please fix lint?

@yoshinorin
Copy link
Member

@Cerallin
Continues from hexojs/hexo#4871 (comment)

Do you have any idea to use this option with other renderers? Currently, hexo-renderer-marked and hexo-renderer-markdown-it don't have an option to add custom attributes. They are the official renderer of hexo. IMHO, it is better to use this option with official renderers.

If difficult to implement it, would you please update the docs that users need to customize (extends) the renderer by themselves to add an attributes.

I assume users will be confused "this option can be used in official renderers by default".

@SukkaW
Do you have any suggestions?

@Cerallin
Copy link
Contributor Author

Cerallin commented Jan 22, 2022

@yoshinorin
This is a plugin for markdown-it: markdown-it-attrs.
And for marked, maybe we need to implement the feature by ourselves.

@Cerallin
Copy link
Contributor Author

Support for markdown-it-attrs is added via hexojs/hexo-renderer-markdown-it#174.

@yoshinorin yoshinorin merged commit 837008b into hexojs:master Jan 29, 2022
nevilm-lt pushed a commit to nevilm-lt/hexo-util that referenced this pull request Apr 22, 2022
* feat(toc_obj): Support unnumbered headings

* Update readme

* Rollback TOC

* Fix typo

* Fix lint
nevilm-lt pushed a commit to nevilm-lt/hexo-util that referenced this pull request Apr 22, 2022
* feat(toc_obj): Support unnumbered headings

* Update readme

* Rollback TOC

* Fix typo

* Fix lint
nevilm-lt pushed a commit to nevilm-lt/hexo-util that referenced this pull request Apr 22, 2022
* feat(toc_obj): Support unnumbered headings

* Update readme

* Rollback TOC

* Fix typo

* Fix lint
nevilm-lt pushed a commit to nevilm-lt/hexo-util that referenced this pull request Apr 22, 2022
* feat(toc_obj): Support unnumbered headings

* Update readme

* Rollback TOC

* Fix typo

* Fix lint
himanshiLt pushed a commit to himanshiLt/hexo-util that referenced this pull request Apr 25, 2022
* feat(toc_obj): Support unnumbered headings

* Update readme

* Rollback TOC

* Fix typo

* Fix lint
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

Successfully merging this pull request may close these issues.

None yet

3 participants