Skip to content

Fix missing underscore #578

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

Merged
merged 1 commit into from
Oct 20, 2022
Merged

Conversation

butterunderflow
Copy link
Contributor

The current behavior is: underscore is included in the heading, but missing in the sidebar.
For example:
image
the tail _ of test_ is missing in the sidebar.

It seems was originally raised from here:
https://github.com/rescript-association/rescript-lang.org/blob/b0da61146a0718337957e79569b5386220d55f93/scripts/extract-indices.mjs#L31
We only fetch the value of the first child of a mdast node as the name attribute.
But when a heading contains escape characters like \_, children will be a list. Like

[
  {
    type: 'text',
    value: 'test',
    position: Position { start: [Object], end: [Object], indent: [] }
  },
  {
    type: 'text',
    value: '_',
    position: Position { start: [Object], end: [Object], indent: [] }
  }
]

This PR seems to give a fix.

@ryyppy
Copy link
Member

ryyppy commented Oct 20, 2022

oh, how did we miss that. Looking good, thanks

@ryyppy ryyppy merged commit 9ad667d into rescript-lang:master Oct 20, 2022
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.

3 participants