Codeberg/Documentation
42
199
Fork
You've already forked Documentation
161

Automatically generate Table of Contents for each page #376

Merged
Gusted merged 1 commit from :toc into main 2023年12月11日 18:32:15 +01:00
Contributor
Copy link

Closes #24.

Closes #24.
oatbiscuits changed title from (削除) WIP: Automatically generate Table of Contents for each page. (削除ここまで) to WIP: Automatically generate Table of Contents for each page 2023年12月08日 06:26:00 +01:00
Gusted left a comment
Copy link

Seems pretty straight forward.

Seems pretty straight forward.
@ -189,0 +207,4 @@
margin: var(--sidebar-link-margin);
min-height: var(--sidebar-link-height);
height: auto;
color: var(--lm-sidebar-link-text-color);
Owner
Copy link

--lm stands for light-mode, so in the dark mode these colors will be incorrect. I think it's better to remove the color, background-color and border property instead add the sidebar-link class to the <a> element. As sidebar-link is the class defined by codeberg.css that will contain the correct value as it takes into account the dark and light mode.

`--lm` stands for `light-mode`, so in the dark mode these colors will be incorrect. I think it's better to remove the `color`, `background-color` and `border` property instead add the `sidebar-link` class to the `<a>` element. As `sidebar-link` is the class defined by [codeberg.css](https://design.codeberg.org/design-kit/codeberg.css) that will contain the correct value as it takes into account the dark and light mode.
oatbiscuits marked this conversation as resolved
package.json Outdated
@ -18,2 +18,4 @@
"markdown-it-anchor": "^8.6.7",
"pagefind": "^1.0.4"
},
"dependencies": {
Owner
Copy link

Could you run:

$ npm i @uncenter/eleventy-plugin-toc -D

So that this dependency is moved to the dev dependencies.

Could you run: ```console $ npm i @uncenter/eleventy-plugin-toc -D ``` So that this dependency is moved to the dev dependencies.
oatbiscuits marked this conversation as resolved
Author
Contributor
Copy link

@Gusted should be good, but since the plugin for generating the TOC is not letting me directly specify a CSS class for the links, I used replace filter from Nunjucks to add the class. Hope that's ok. Otherwise, I could fork it but I don't think adding the burden of maintaining the plugin on me or this repository is wiser than working with what we have.

@Gusted should be good, but since the plugin for generating the TOC is not letting me directly specify a CSS class for the links, I used [`replace`](https://mozilla.github.io/nunjucks/templating.html#replace) filter from Nunjucks to add the class. Hope that's ok. Otherwise, I could fork it but I don't think adding the burden of maintaining the plugin on me or this repository is wiser than working with what we have.
oatbiscuits changed title from (削除) WIP: Automatically generate Table of Contents for each page (削除ここまで) to Automatically generate Table of Contents for each page 2023年12月09日 14:53:08 +01:00

I used replace filter from Nunjucks to add the class. Hope that's ok. Otherwise, I could fork it but I don't think adding the burden of maintaining the plugin on me or this repository is wiser than working with what we have.

That's fine! No need to fork it, I wasn't aware you couldn't do that trough the current library. I do think the replace should happen in wrapper function, so the replace filter doesn't have to duplicated in the template files. Otherwise the PR looks fine!

> I used replace filter from Nunjucks to add the class. Hope that's ok. Otherwise, I could fork it but I don't think adding the burden of maintaining the plugin on me or this repository is wiser than working with what we have. That's fine! No need to fork it, I wasn't aware you couldn't do that trough the current library. I do think the replace should happen in `wrapper` function, so the replace filter doesn't have to duplicated in the template files. Otherwise the PR looks fine!
Author
Contributor
Copy link

@Gusted Done :)

@Gusted Done :)
Gusted left a comment
Copy link

Layout et al. looks good on desktop and mobile!

Layout et al. looks good on desktop and mobile!
@ -189,0 +217,4 @@
}
#toc-side ol:first-child {
border-left: 1px solid rgba(0, 0, 0, 0.15);
Owner
Copy link

This will need to take into account dark mode, as this is not a visible color. I would suggest simply using rgba(255, 255, 255, 0.15) for dark mode.

This will need to take into account dark mode, as this is not a visible color. I would suggest simply using `rgba(255, 255, 255, 0.15)` for dark mode.
oatbiscuits marked this conversation as resolved

@n0toose Do you want to add something?

@n0toose Do you want to add something?
Gusted left a comment
Copy link

Many thanks!

Many thanks!

Do you want to add something?

Nope, feel free to merge :)

> Do you want to add something? Nope, feel free to merge :)
Sign in to join this conversation.
No reviewers
Labels
Clear labels
Codeberg Pages
Issues affecting Codeberg Pages
Documentation Usability
Issues related to using and reading docs.codeberg.org
Forgejo
Good First Issue! 👋
Kind: Bug
Kind: Documentation
Kind: Enhancement
Kind: Feature
Kind: Question
Kind: Security
Licensing
Part: Generator
This is related to the generation of the documentation, not to the content itself
Priority: High
The priority is high
Priority: Low
The priority is low
Priority: Medium
The priority is medium
Reviewed: Confirmed
Something has been confirmed
Reviewed: Duplicate
Something exists already
Reviewed: Invalid
Something was marked as invalid
Reviewed: Wontfix
Something won't be fixed
Status: Blocked
Status: Help wanted
Contributions are welcome!
Status: In progress
Work is in progress
Status: Needs feedback
Feedback is needed
Status: Ready for Review
Work is completed
Status: Review
Review is in progress / Reviewers wanted
Status: Stale
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Codeberg/Documentation!376
Reference in a new issue
Codeberg/Documentation
No description provided.
Delete branch ":toc"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?