Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Heading-ids in MRG Entries should be useable as fragments #40

Open
RieksJ opened this issue Oct 19, 2022 · 0 comments
Open

Heading-ids in MRG Entries should be useable as fragments #40

RieksJ opened this issue Oct 19, 2022 · 0 comments
Labels
feature A new feature or enhancements good first issue Good for newcomers prio=high

Comments

@RieksJ
Copy link
Contributor

RieksJ commented Oct 19, 2022

MRG Entries may have a field headingids that contains the list of header items that are in the Curated Text that the MRG Entry documents. Examples are: # TEv2 Curated Text Header or ### Summary.

The idea was/is that these texts could be used as fragment identifiers, by appending #<headeridelement> to the navurl. So rather than ### Summary, I would like to see summary.

This issue calls for a conversion of the elements in headingids such that they become useful as fragment identifiers.
This means:

  1. Look for a custom heading ID at the end of the header text (something like {#my-heading-id}, i.e., a match with regex \{\s*#([^\s]+)\s*\}.
  2. If found, use the my-heading-id part, i.e.: the capturing group in the regex, as the value for the heading-id field)
  3. If not found, do the following
    1. Strip the leading #-characters and spaces.
    2. Convert the text to lower-case.
    3. Replace any sequence of one or more characters that are not in the range [a..z] with a single -character.
    4. use the result as the value for the heading-id field.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature A new feature or enhancements good first issue Good for newcomers prio=high
Projects
None yet
Development

No branches or pull requests

1 participant