Skip to content

Commit fe93c46

Browse files
committed
Fix Tools link
1 parent 613ebe3 commit fe93c46

File tree

6 files changed

+30
-20
lines changed

6 files changed

+30
-20
lines changed

src/components/BlogLayout/index.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ interface Props {
1010
guestBio: string
1111
rawMarkdownBody: string
1212
sideBarData: any
13+
pageContext: any
1314
}
1415

1516
const index = ({
@@ -20,6 +21,7 @@ const index = ({
2021
guestBio,
2122
rawMarkdownBody,
2223
sideBarData,
24+
pageContext
2325
}: Props) => {
2426
return (
2527
<section>
@@ -32,17 +34,21 @@ const index = ({
3234
guestBio={guestBio}
3335
rawMarkdownBody={rawMarkdownBody}
3436
isPermalink={true}
37+
pageContext={pageContext}
3538
/>
36-
<BlogSidebar posts={sideBarData[0].links.sort(((a: any, b: any) => {
37-
const aDate = new Date(a.frontmatter.date);
39+
<BlogSidebar
40+
posts={sideBarData[0].links.sort((a: any, b: any) => {
41+
const aDate = new Date(a.frontmatter.date)
3842
const bDate = new Date(b.frontmatter.date)
3943
if (aDate > bDate) {
40-
return -1;
44+
return -1
4145
} else if (aDate < bDate) {
42-
return 1;
46+
return 1
4347
}
44-
return 0;
45-
}))} currentPermalink={permalink} />
48+
return 0
49+
})}
50+
currentPermalink={permalink}
51+
/>
4652
</div>
4753
</section>
4854
)

src/components/BlogPost/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ interface Props {
99
guestBio: string
1010
rawMarkdownBody: string
1111
isPermalink: boolean
12+
pageContext: any
1213
}
1314

1415
const BlogPost = ({
@@ -19,6 +20,7 @@ const BlogPost = ({
1920
guestBio,
2021
rawMarkdownBody,
2122
isPermalink,
23+
pageContext
2224
}: Props) => (
2325
<div className="inner-content">
2426
<h1>{isPermalink ? title : <a href={permalink}>{title}</a>}</h1>
@@ -29,7 +31,7 @@ const BlogPost = ({
2931
{guestBio && (
3032
<p className="guestBio">{`This guest article contributed by ${byline}, ${guestBio}.`}</p>
3133
)}
32-
<Marked>{rawMarkdownBody}</Marked>
34+
<Marked pageContext={pageContext}>{rawMarkdownBody}</Marked>
3335
</div>
3436
)
3537

src/components/CodeLayout/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React from 'react'
22
import Marked from "../Marked";
33

4-
export default ({ title, rawMarkdownBody }: any) => (
4+
export default ({ title, rawMarkdownBody, pageContext }: any) => (
55
<section>
66
<div className="documentationContent">
77
<div className="inner-content">
88
<h1>{title}</h1>
9-
<Marked>{rawMarkdownBody}</Marked>
9+
<Marked pageContext={pageContext}>{rawMarkdownBody}</Marked>
1010
</div>
1111
</div>
1212
</section>

src/components/DocsLayout/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ interface Props {
99
permalink: string
1010
sideBarData: any
1111
rawMarkdownBody: string
12+
pageContext: any
1213
}
1314

14-
const index = ({ title, nextDoc, sideBarData, rawMarkdownBody }: Props) => {
15+
const index = ({ title, nextDoc, sideBarData, rawMarkdownBody, pageContext }: Props) => {
1516
return (
1617
<section>
1718
<div className="documentationContent">
1819
<div className="inner-content">
1920
<h1>{title}</h1>
20-
<Marked>{rawMarkdownBody}</Marked>
21+
<Marked pageContext={pageContext}>{rawMarkdownBody}</Marked>
2122
{nextDoc?.frontmatter?.permalink && (
2223
<Link className="read-next" to={nextDoc.frontmatter.permalink}>
2324
<span className="read-next-continue">

src/components/Marked/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import MiniGraphiQL from "./MiniGraphiQL"
1414
import { StarWarsSchema } from "./swapiSchema"
1515
import { UsersSchema } from './usersSchema';
1616

17-
export default function Marked(props) {
17+
export default function Marked(props: { pageContext: any; children: any; }) {
1818
return <div>{marked(props.children, props)}</div>
1919
}
2020

@@ -759,7 +759,8 @@ function Parser(options) {
759759
this.tokens = []
760760
this.token = null
761761
this.options = options || marked.defaults
762-
this.usedSlugs = {}
762+
this.options.pageContext.usedSlugs = this.options.pageContext.usedSlugs || {}
763+
this.usedSlugs = this.options.pageContext.usedSlugs
763764
}
764765

765766
/**

src/pages/code.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export function buildLibraryCategoriesMarkdown(
8787
let markdown = ""
8888
if (libraryCategoryName in libraryCategories) {
8989
markdown += `### ${libraryCategoryName}\n`
90-
const libraries = libraryCategories[libraryCategoryName]
90+
const libraries = libraryCategories[libraryCategoryName as any]
9191
markdown += buildLibraryListMarkdown(libraries)
9292
markdown += "\n"
9393
}
@@ -112,10 +112,10 @@ export function buildLanguagesContent(pageContext: any) {
112112
"Tools"
113113
)
114114
}
115-
return <Marked>{markdown}</Marked>
115+
return <Marked pageContext={pageContext}>{markdown}</Marked>
116116
}
117117

118-
export default ({ pageContext }) => {
118+
export default ({ pageContext }: any) => {
119119
return (
120120
<Layout title="Code" className="code" pageContext={pageContext}>
121121
<div className="code-hero">
@@ -155,7 +155,7 @@ export default ({ pageContext }) => {
155155
</a>
156156
</div>
157157
</div>
158-
<Marked>{`
158+
<Marked pageContext={pageContext}>{`
159159
## Languages
160160
`}</Marked>
161161
<p>
@@ -167,19 +167,19 @@ export default ({ pageContext }) => {
167167
{buildLanguagesMenu(pageContext)}
168168

169169
{buildLanguagesContent(pageContext)}
170-
<Marked>
170+
<Marked pageContext={pageContext}>
171171
{`
172172
## Tools
173173
${buildLibraryListMarkdown(pageContext.codeData.Tools)}
174174
`}
175175
</Marked>
176-
<Marked>
176+
<Marked pageContext={pageContext}>
177177
{`
178178
## Services
179179
${buildLibraryListMarkdown(pageContext.codeData.Services)}
180180
`}
181181
</Marked>
182-
<Marked>
182+
<Marked pageContext={pageContext}>
183183
{`
184184
## More Stuff
185185
${buildLibraryListMarkdown(pageContext.codeData["More Stuff"])}

0 commit comments

Comments
 (0)