-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
6,607 additions
and
7,262 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,6 @@ | ||
--- | ||
'@rocketseat/gatsby-theme-docs-core': major | ||
'@rocketseat/gatsby-theme-docs': major | ||
--- | ||
|
||
Upgrade to Gatsby v5 |
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
24 changes: 24 additions & 0 deletions
24
@rocketseat/gatsby-theme-docs-core/rehype-meta-as-attributes.js
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,24 @@ | ||
const visit = require(`unist-util-visit`); | ||
|
||
exports.rehypeMetaAsAttributes = function rehypeMetaAsAttributes() { | ||
return (tree) => { | ||
// A regex that looks for a simplified attribute name, optionally followed | ||
// by a double, single, or unquoted attribute value | ||
const re = /\b([-\w]+)(?:=(?:"([^"]*)"|'([^']*)'|([^"'\s]+)))?/g; | ||
|
||
// … | ||
visit(tree, 'element', (node) => { | ||
let match; | ||
|
||
if (node.tagName === 'code' && node.data && node.data.meta) { | ||
re.lastIndex = 0; // Reset regex. | ||
|
||
// eslint-disable-next-line no-cond-assign | ||
while ((match = re.exec(node.data.meta))) { | ||
node.properties[match[1]] = match[2] || match[3] || match[4] || ''; | ||
} | ||
} | ||
}); | ||
// … | ||
}; | ||
}; |
22 changes: 22 additions & 0 deletions
22
@rocketseat/gatsby-theme-docs-core/remark-headings-plugin.js
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,22 @@ | ||
const visit = require(`unist-util-visit`); | ||
const toString = require(`mdast-util-to-string`); | ||
|
||
exports.remarkHeadingsPlugin = function remarkHeadingsPlugin() { | ||
return async function transformer(tree, file) { | ||
const headings = []; | ||
|
||
visit(tree, `heading`, (heading) => { | ||
headings.push({ | ||
value: toString(heading), | ||
depth: heading.depth, | ||
}); | ||
}); | ||
|
||
const mdxFile = file; | ||
if (!mdxFile.data.meta) { | ||
mdxFile.data.meta = {}; | ||
} | ||
|
||
mdxFile.data.meta.headings = headings; | ||
}; | ||
}; |
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 |
---|---|---|
|
@@ -17,7 +17,6 @@ export const query = graphql` | |
image | ||
disableTableOfContents | ||
} | ||
body | ||
headings { | ||
depth | ||
value | ||
|
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
Oops, something went wrong.
ed4b5b3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
rocketdocs-gatsby-theme-docs – ./
rocketdocs-gatsby-theme-docs-git-main-jpedroschmitz.vercel.app
rocketdocs-gatsby-theme-docs-jpedroschmitz.vercel.app
rocketdocs-gatsby-theme-docs.vercel.app