table of contents update
- added "s" to table on contents - fixed broken white-link css - added toc link to headers
This commit is contained in:
parent
6f01857803
commit
ffd0a194de
5 changed files with 25 additions and 14 deletions
|
@ -6,8 +6,8 @@ import markDownItMark from "markdown-it-mark" // text highlighting
|
||||||
import markdownItSub from "markdown-it-sub" // markdown subscript
|
import markdownItSub from "markdown-it-sub" // markdown subscript
|
||||||
import markdownItSup from "markdown-it-sup" // markdown superscript
|
import markdownItSup from "markdown-it-sup" // markdown superscript
|
||||||
import highlightLines from "markdown-it-highlight-lines" // highlighting specific lines in code blocks
|
import highlightLines from "markdown-it-highlight-lines" // highlighting specific lines in code blocks
|
||||||
import hljs from "highlight.js" // code block syntax highlighting
|
|
||||||
|
|
||||||
|
import hljs from "highlight.js" // code block syntax highlighting
|
||||||
import katex from "katex" // rendering mathematical expression
|
import katex from "katex" // rendering mathematical expression
|
||||||
import "katex/contrib/mhchem" // chemical formula
|
import "katex/contrib/mhchem" // chemical formula
|
||||||
|
|
||||||
|
@ -31,8 +31,12 @@ const md = markdownIt({
|
||||||
engine: katex,
|
engine: katex,
|
||||||
delimiters: "dollars",
|
delimiters: "dollars",
|
||||||
})
|
})
|
||||||
|
.use(markdownItAnchor, {
|
||||||
|
permalink: true,
|
||||||
|
permalinkBefore: true,
|
||||||
|
permalinkSymbol: "#",
|
||||||
|
})
|
||||||
.use(markdownItTaskCheckbox)
|
.use(markdownItTaskCheckbox)
|
||||||
.use(markdownItAnchor, {})
|
|
||||||
.use(markDownItMark)
|
.use(markDownItMark)
|
||||||
.use(markdownItSub)
|
.use(markdownItSub)
|
||||||
.use(markdownItSup)
|
.use(markdownItSup)
|
||||||
|
|
|
@ -19,10 +19,6 @@ import NotFound from "./pages/NotFound"
|
||||||
import theming from "./styles/theming"
|
import theming from "./styles/theming"
|
||||||
import GlobalStyle from "./styles/globalStyle"
|
import GlobalStyle from "./styles/globalStyle"
|
||||||
|
|
||||||
// Theme that will be used throughout the website
|
|
||||||
// wrapping it using css because prettier extension does not work well with styled-components
|
|
||||||
// https://github.com/styled-components/vscode-styled-components/issues/175
|
|
||||||
|
|
||||||
const IENotSupported = styled.p`
|
const IENotSupported = styled.p`
|
||||||
margin: auto;
|
margin: auto;
|
||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
|
|
|
@ -45,16 +45,16 @@ const Toc = (props: { fetchedPage: FetchedPage }) => {
|
||||||
setIsTocOpened((prev) => !prev)
|
setIsTocOpened((prev) => !prev)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<strong>Table of Content </strong>
|
<strong>
|
||||||
{isTocOpened ? (
|
Table of Contents{" "}
|
||||||
<FontAwesomeIcon icon={faCaretUp} />
|
<FontAwesomeIcon
|
||||||
) : (
|
icon={isTocOpened ? faCaretUp : faCaretDown}
|
||||||
<FontAwesomeIcon icon={faCaretDown} />
|
/>
|
||||||
)}
|
</strong>
|
||||||
</StyledTocToggleButton>
|
</StyledTocToggleButton>
|
||||||
<StyledCollapseContainer>
|
<StyledCollapseContainer>
|
||||||
<Collapse isOpened={isTocOpened}>
|
<Collapse isOpened={isTocOpened}>
|
||||||
<div className="white-link">{props.fetchedPage.toc}</div>
|
<div>{props.fetchedPage.toc}</div>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
</StyledCollapseContainer>
|
</StyledCollapseContainer>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
|
@ -199,7 +199,6 @@ const Page = () => {
|
||||||
|
|
||||||
{/* page content */}
|
{/* page content */}
|
||||||
<div
|
<div
|
||||||
className="white-link"
|
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: fetchedPage.content,
|
__html: fetchedPage.content,
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -194,6 +194,9 @@ const markCSS = css`
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
// Theme that will be used throughout the website
|
||||||
|
// wrapping it using css because prettier extension does not work well with styled-components
|
||||||
|
// https://github.com/styled-components/vscode-styled-components/issues/175
|
||||||
const globalStyle = css`
|
const globalStyle = css`
|
||||||
${scrollbarCSS}
|
${scrollbarCSS}
|
||||||
${codeCSS}
|
${codeCSS}
|
||||||
|
@ -232,6 +235,15 @@ const globalStyle = css`
|
||||||
text-rendering: optimizeLegibility;
|
text-rendering: optimizeLegibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: ${theming.color.linkColor};
|
||||||
|
|
||||||
|
&:visited {
|
||||||
|
color: ${theming.color.linkColor};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
transition: color 0.1s linear;
|
transition: color 0.1s linear;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue