Add classes to reference toc #10

Merged
ashtonsix merged 5 commits from ref-toc into master 2021-10-28 08:10:58 +02:00
ashtonsix commented 2021-10-26 22:16:21 +02:00 (Migrated from github.com)

Before:

before

After:

after

Before: ![before](https://user-images.githubusercontent.com/6740947/138954220-201f6353-c5ae-434f-8098-487ac7ce8c76.png) After: ![after](https://user-images.githubusercontent.com/6740947/138954112-706e7a6f-6460-4f9d-b309-6a3589689d7b.png)
marijnh commented 2021-10-26 23:47:12 +02:00 (Migrated from github.com)

I'm not sure about this—it seems like it'll overflow most user's vertical screen space if we get a few more classes, and it seems arbitrary to list classes but not other exports.

What might work is adding section headers to the doc templates and linking those, like on https://prosemirror.net/docs/ref/

I'm not sure about this—it seems like it'll overflow most user's vertical screen space if we get a few more classes, and it seems arbitrary to list classes but not other exports. What might work is adding section headers to the doc templates and linking those, like on https://prosemirror.net/docs/ref/
ashtonsix commented 2021-10-27 00:32:31 +02:00 (Migrated from github.com)

Sure. Updated:

updated

Sure. Updated: ![updated](https://user-images.githubusercontent.com/6740947/138970350-8befce94-5715-4b7b-b292-f78390c94ee0.png)
marijnh (Migrated from github.com) reviewed 2021-10-27 08:13:45 +02:00
@ -59,7 +59,22 @@ function backToRoot(dir) {
mapDir(join(base, "site"), join(base, "output"), (fullPath, name) => {
marijnh (Migrated from github.com) commented 2021-10-27 08:13:44 +02:00

I don't think [\w\s] covers every character. And it seems like you don't need to involve the content and close tag at all here, and can just only replace the open tag.

I don't think `[\w\s]` covers every character. And it seems like you don't need to involve the content and close tag at all here, and can just only replace the open tag.
ashtonsix (Migrated from github.com) reviewed 2021-10-27 17:53:45 +02:00
@ -59,7 +59,22 @@ function backToRoot(dir) {
mapDir(join(base, "site"), join(base, "output"), (fullPath, name) => {
ashtonsix (Migrated from github.com) commented 2021-10-27 17:53:45 +02:00

I've changed [\w\s] to [\S\s] which covers every charachter.

I'm not sure what you had in mind with "it seems like you don't need to involve the content and close tag at all here, and can just only replace the open tag".

The purpose of lines 68 to 72 is to add ids to the section headers so that they can be targetted by anchor links. Yes, we only need to replace the open tag for this. However, I believe we still need to involve the header content (to figure out what the id should be) and end tag (to know where the content ends).

Before:

<h3>Trees</h3>

After:

<h3 id="common.Trees">Trees</h3>

Let me know if I'm missing something.

I've changed `[\w\s]` to `[\S\s]` which covers every charachter. I'm not sure what you had in mind with "it seems like you don't need to involve the content and close tag at all here, and can just only replace the open tag". The purpose of lines 68 to 72 is to add ids to the section headers so that they can be targetted by anchor links. Yes, we only need to replace the open tag for this. However, I believe we still need to involve the header content (to figure out what the id should be) and end tag (to know where the content ends). Before: ```html <h3>Trees</h3> ``` After: ```html <h3 id="common.Trees">Trees</h3> ``` Let me know if I'm missing something.
marijnh (Migrated from github.com) reviewed 2021-10-27 19:01:16 +02:00
@ -59,7 +59,22 @@ function backToRoot(dir) {
mapDir(join(base, "site"), join(base, "output"), (fullPath, name) => {
marijnh (Migrated from github.com) commented 2021-10-27 19:01:16 +02:00

Oh, right, you do indeed need the content.

Maybe replace /\W+/ with underscores in the id to avoid generating invalid anchors? And I think it'd make sense to simplify a little (as well as avoid hard-coding the id structure in two places) by directly adding the TOC entries from the replace callback.

Oh, right, you do indeed need the content. Maybe replace `/\W+/` with underscores in the id to avoid generating invalid anchors? And I think it'd make sense to simplify a little (as well as avoid hard-coding the id structure in two places) by directly adding the TOC entries from the `replace` callback.
ashtonsix (Migrated from github.com) reviewed 2021-10-27 22:52:36 +02:00
@ -59,7 +59,22 @@ function backToRoot(dir) {
mapDir(join(base, "site"), join(base, "output"), (fullPath, name) => {
ashtonsix (Migrated from github.com) commented 2021-10-27 22:52:35 +02:00

Done

Done
marijnh commented 2021-10-28 08:13:17 +02:00 (Migrated from github.com)

Thanks! I've rebuilt the ref guide and it's looking good.

Thanks! I've rebuilt [the ref guide](https://lezer.codemirror.net/docs/ref/) and it's looking good.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
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
lezer/website!10
No description provided.