Added custom code based slugger for making <details> blocks linkable#3352
Added custom code based slugger for making <details> blocks linkable#3352yathomasi wants to merge 7 commits into
<details> blocks linkable#3352Conversation
rogermparent
left a comment
There was a problem hiding this comment.
I'm not too enthusiastic about this one, if a manual id is going to be provided then I imagine it should entirely take the place of the generated slug; a completely manual id gives the same benefits as a combined slug with simpler code and the added benefit of being able to change the details block's text without breaking existing links to it.
Or I think we can do it this way: if we add |
It would be an improvement, but I don't see any use case for a code+content-derived id that isn't already solved by a code-only id. |
|
close in favor of #3329. |
This is another solution for making a unique link for the
<details>block. This uses custom Slugger to provide the custom code/word to make the hash link unique and eliminates the possibility of links pointing to another place if we perform some page updates.Some considerations with this methods are:
positionfor the position of the code in the hash link (which is "end" by default, also accepts "start")For an example implementation, I have updated
docs/start/data-and-model-versioningwhich had two<details>components with the titleExpand to see what happens under the hood.so I have updated one withcodeand also used optionalpositointo place the code at the start of the hash id.The generated link will be
/doc/start/data-and-model-versioning#storing-and-sharing-Expand-to-see-what-happens-under-the-hood.Note: This preview deployment may fail since I have not updated all the docs
<details>block having the same title.Continue on PR #3329