Skip to content

Commit

Permalink
Merge pull request #164 from eecs485staff/italic-headings
Browse files Browse the repository at this point in the history
Retain most HTML elements in heading label in Table of Contents
  • Loading branch information
seshrs authored Apr 7, 2022
2 parents 8244a2a + 61455ac commit 8b78a54
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ graph TB
# Setup
Follow these steps to get your development environment set up.

### Install the dependencies
### **_Install_** the dependencies
First make sure that you have Python 3 installed. If you're on MacOS, you may have to `brew install python3` first.

```console
Expand Down
14 changes: 14 additions & 0 deletions src_js/components/sidebar/TableOfContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,20 @@ function getHeadingLabel(headingNode: HTMLElement): h.JSX.Element {
);
} else if (childNode.tagName === 'ABBR') {
labelComponents.push(<Fragment>{childNode.innerText}</Fragment>);
} else if (
childNode.tagName === 'A' &&
childNode.classList.contains('anchorjs-link')
) {
// Skip the AnchorJS link
return;
} else {
// Retain any other HTML elements
labelComponents.push(
<span
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: childNode.outerHTML }}
/>,
);
}
break;
}
Expand Down

0 comments on commit 8b78a54

Please sign in to comment.