-
Notifications
You must be signed in to change notification settings - Fork 193
Closed
Description
Hi team,
I'm trying to pull out a list of IDs that are within my MDX which will match the regex of const TWEET_RE = /<StaticTweet\sid="[0-9]+"\s\/>/g; that I can then use to perform getStaticProps.
Mainly trying to follow this specific tutorial : https://blog.maximeheckel.com/posts/static-tweets-with-mdx-nextjs/
I was wondering if there's an easy way to modify the makeSource config folder so that I can simply map over the individual file contents within my target folder to extract these IDs.
This is my existing makeSource config.
export default makeSource({
contentDirPath: "posts",
documentTypes: [Post],
mdx: {
rehypePlugins: [
[
rehypePrettyCode,
{
// theme: "github-dark",
theme: JSON.parse(readFileSync(themePath, "utf-8")),
onVisitLine(node: any) {
// Prevent lines from collapsing in `display: grid` mode, and allow empty
// lines to be copy/pasted
if (node.children.length === 0) {
node.children = [{ type: "text", value: " " }];
}
},
onVisitHighlightedLine(node: any) {
node.properties.className.push("line--highlighted");
},
onVisitHighlightedWord(node: any) {
node.properties.className = ["word--highlighted"];
},
},
],
],
},
});Thank you so much!
Metadata
Metadata
Assignees
Labels
No labels