Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

documentation: prefix heading identifiers to avoid collisions #663

Merged
merged 1 commit into from
Jan 13, 2020

Conversation

davidchambers
Copy link
Member

Commit message:

Identifiers are automatically generated for both headings and functions. Currently these can collide. It is currently impossible to link directly to S.array because it has the same fragment identifier as the ‘Array’ section in which it resides.

This commit adds a script to be run during readme generation, which wraps the text of each heading in <span id="section:...">❑ ...</span>. GitHub's algorithm converts the LOWER RIGHT SHADOWED WHITE SQUARE to a hyphen, which prevents GitHub's heading identifiers from colliding with function identifiers (control characters are rendered as �, and GitHub's algorithm ignores space characters, so a visible character is required).

Before:

### Array

After:

### <span id="section:array">❑ Array</span>

The heading above will have two fragment identifiers, #section:array and #-array (assigned by GitHub), neither of which collides with #array, the fragment identifier for S.array.

Identifiers are automatically generated for both headings and functions.
Currently these can collide. It is currently impossible to link directly
to `S.array` because it has the same fragment identifier as the ‘Array’
section in which it resides.

This commit adds a script to be run during readme generation, which
wraps the text of each heading in <span id="section:...">❑ ...</span>.
GitHub's algorithm converts the LOWER RIGHT SHADOWED WHITE SQUARE to a
hyphen, which prevents GitHub's heading identifiers from colliding with
function identifiers (control characters are rendered as �, and GitHub's
algorithm ignores space characters, so a visible character is required).

Before:

    ### Array

After:

    ### <span id="section:array">❑ Array</span>

The heading above will have two fragment identifiers, #section:array and
#-array (assigned by GitHub), neither of which collides with #array, the
fragment identifier for `S.array`.
@davidchambers davidchambers merged commit 0dd4e57 into master Jan 13, 2020
@davidchambers davidchambers deleted the davidchambers/identifiers branch January 13, 2020 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant