stupid prismjs

This commit is contained in:
Xetera
2019-07-26 14:37:31 -07:00
parent 6982552205
commit 36f4e41e16
16 changed files with 2234 additions and 646 deletions
+61 -6
View File
@@ -1,7 +1,62 @@
/**
* Implement Gatsby's Node APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/node-apis/
*/
const { graphql } = require('gatsby');
const { createFilePath } = require("gatsby-source-filesystem");
const path = require(`path`)
// You can delete this file if you're not using it
const usersEndpoint = (id) => `https://discordapp.com/api/guilds/${id}/members`;
const fetchUsers = () => {
// Fetch user data from discord using bot token here
}
const createDocs = async ({ createPage, graphql }) => {
const languageDocs = path.resolve(`src/templates/languagePost.tsx`)
const result = await graphql(`
{
allFile(filter: {sourceInstanceName: {eq: "docs"}}) {
edges {
node {
relativePath
childMarkdownRemark {
frontmatter {
author
date
}
}
}
}
}
}
`);
if (result.errors) {
return Promise.reject(result.errors)
}
return result.data.allFile.edges.forEach(({ node }) => {
createPage({
path: path.join('docs', node.relativePath),
component: languageDocs,
context: {
file: node.relativePath
},
})
})
}
exports.onCreateNode = async ({ node, getNode, actions }) => {
const { createPage, createNodeField } = actions;
if (node.internal.type === "MarkdownRemark") {
const slug = createFilePath({ node, getNode, basePath: "src/content/docs" })
createNodeField({
node,
name: "slug",
value: slug
});
}
}
exports.createPages = ({ actions, graphql }) => {
const { createPage } = actions
return createDocs({ createPage, graphql });
}