<details> blocks linkable#3329
Conversation
There was a problem hiding this comment.
Note to self: follow-up with removing "Click for" prefixes in ref/remote/modify & ref/remote/add.
| const id = triggerChildren | ||
| .toString() | ||
| .replace(/[^a-zA-Z ]/g, '') | ||
| .toLowerCase() |
There was a problem hiding this comment.
do we need to lowercase?
| .toLowerCase() |
There was a problem hiding this comment.
Umm, just for the fact that lowercase is better for URL but it is not compulsory. Do we have reason, not to use lowercase?
There was a problem hiding this comment.
Yes capitalisation is nice to keep. We already keep it for our ?tab=XyZ functionality. No strong opinion here though.
There was a problem hiding this comment.
For consistency, wouldn't we want them to be lowercase? All of our other anchor links are lowercase. While tabs do use capitalization, tabs use URL queries, not anchor links.
|
This update generates the hash links for titles serially unique on page level(the previous version had uniqueness on whole docs level so there could be hash link starting from numbers even it's occurred 1st time on the page). This one is simple and for simple titles only it seems to be adopted this way eg: Mermaid sequence diagram. But, the possible problem with this method is updating the page and adding another Also, I will also be submitting another pr which will have the custom slugger where we can also provide some random code/words through props to make the hash link unique. |
Personally, I don't see this as a huge issue 🤔 Our headings work the same way. Should we avoid making a custom slugger and just use
I feel like hash link creation should be completely automated. Plus, wouldn't that make URLs more lengthy and less readable? |
|
Quick Q. What about
From #3153 (comment) ? I.e. will we keep the custom |
I believe so! Collapsible admonitions will probably be created by expanding the |
I also prefer this way as:
I think the |
|
@yathomasi, what's blocking this from being merged? Is it waiting on the decision between using a custom slugger and |
Yes, @iterative/docs can also help to decide on which could be better. We already kind of have our preference. |
|
@iterative/docs, we're discussing adding some props to
Aka would create a details block with the link being |
|
@julieg18 Thank you for putting this clearly here. |
|
IMO just using the existing title would be ideal e.g. |
This comment was marked as resolved.
This comment was marked as resolved.
The initial motivation for |
|
Oh I see, good point. We probably shouldn't use headers for |
Yeah, it's ready for review. To clear the point, we basically have two options to make the id unique:
examples:
The pros and cons of both methods are already discussed(if any queries can be discussed). So, now we need to decide which one should we go with? |
|
I vote for reusing |
So if I'm understanding correctly, we should add a Also, @yathomasi, I don't see any need to use #3352. We can take any props for creating the URL string in the |
So, I assume you mean, provide
For uniqueness, I understand @jorgeorpinel voted for no.1 (current pr) which appends the number if there are two same titles.
Yes, it will all be lowercase(just was trying with @casperdcl 's preference).
I assume you mean #3352 . Yes, if we go with numbering then we don't need that. But, if we want to throw an error if there are two same titles(for manually setting the unique title) or also if we don't want to have numbering then we would need to go with the custom slugger. |
@jorgeorpinel This pr exactly does that. So before merging this, we want to be clear. So, here are some points.
PS: regarding |
There was a problem hiding this comment.
Looks fine to me!
While the structure of the code shows there shouldn't be any crossover with slugger between pages, just to be sure I looked for two pages that have details blocks with the same summary. Conveniently, start/data-and-model-versioning and start/data-and-model-access both have a block with "Expand to see what's under the hood" (the former having two). I saw no issues, so as far as I can tell everything's clear!
|
The commit check is failing on prettier for |
|
@julieg18 @rogermparent thanks for the review.
Yes, seems to be the same one. We can create a new issue if it's not. So, merging this one for now. |
Yes! I think this branch might not have been on the latest version of master :) |
All HTML tags have the
Ah wait that's a good point. That may be problematic. Content gets rearranged all the time. A block that was no 2 in the doc may well become no 4 in the future. Well, it's not that common actually but it can definitely happen. So maybe we should require an |
- follow-up to #3329 - see #3299 (comment)
- follow-up to #3329 - see #3299 (comment)
* details block linkable and expand on current hash * minor fix * fixed title props errror added back tabs component * fix: underscore to dash * fix: remove react-inlinesvg * used github slugger above component level * updated github slugger at the page level * fix: lowercase slugs
- follow-up to #3329 - see #3299 (comment)

Made the
<details>block linkable and will auto expand when the link is opened through the hashed links.Some considerations and possible issues:
titlefor theidattribute which seems to be a good solution until there are some pages that have the same titles in multiple places particularlyExpand to see what happens under the hood.Fix for #3314