This repository has been archived by the owner on Feb 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Wiki Links and Back Links support (#109)
* feat: wikilinks * feat: back links * fix: file names with spaces * fix: slugify block quote links
- Loading branch information
Showing
11 changed files
with
120 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
title: Wiki Links | ||
emoji: ⛓ | ||
tags: | ||
- markdown | ||
created: 2021-04-02T11:04:49.000Z | ||
modified: 2021-04-02T11:55:48.000Z | ||
--- | ||
|
||
## Link your notes | ||
|
||
Make connections between your notes by using `[[note-name]]`. This allows you to easily surf between your connected notes! | ||
|
||
## Back Links | ||
|
||
Links all the notes that references the current note | ||
|
||
### Check out other notes | ||
|
||
- [[markdown-features]] | ||
- [[note-frontmatter]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
gatsby-theme-code-notes/src/components/BackLinks/BackLinks.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react' | ||
import { Box, Link } from 'theme-ui' | ||
|
||
interface IProps { | ||
references: { | ||
frontmatter: { | ||
title: string | ||
} | ||
slug: string | ||
}[] | ||
} | ||
|
||
export const BackLinks: React.FC<IProps> = ({ references }) => ( | ||
<Box as="details" sx={{ my: 4, fontSize: 1 }}> | ||
<Box as="summary" sx={{ textTransform: 'uppercase', fontSize: 0 }}> | ||
Back Links ({references.length}) | ||
</Box> | ||
<Box as="ul" sx={{ listStyleType: 'none', pl: 3 }}> | ||
{references.map((ref) => { | ||
return ( | ||
<li key={`${ref.slug}-item`}> | ||
<Link href={`/${ref.slug.toLowerCase()}`}> | ||
{ref.frontmatter.title} | ||
</Link> | ||
</li> | ||
) | ||
})} | ||
</Box> | ||
</Box> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { BackLinks } from './BackLinks' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const slugify = require('@alexcarpenter/slugify') | ||
|
||
module.exports = (title) => slugify(`/${title}`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters