Skip to content

Commit

Permalink
Merge pull request dotnet#6 from madewithkoji/gatsby-ascii-doc
Browse files Browse the repository at this point in the history
Gatsby ascii doc
  • Loading branch information
rasienko authored Jul 15, 2020
2 parents 412a721 + 3fdeb9a commit 101b769
Show file tree
Hide file tree
Showing 44 changed files with 17,184 additions and 442 deletions.
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Logs
logs
*.log

# Cache
.cache

# Node
node_modules

# Build
public

# IDE specific
.idea/
.vscode/
*.sw*

14 changes: 14 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
The BSD Zero Clause License (0BSD)

Copyright (c) 2020 Gatsby Inc.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# draft-docs

This repo is a place to draft docs and test doc things.
## Installation & Local Development

Clone this repo, install nvm, make sure you are using v12.14.1

`gatsby develop`
28 changes: 28 additions & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Configure your Gatsby site with this file.
*
* See: https://www.gatsbyjs.org/docs/gatsby-config/
*/

module.exports = {
/* Your site config here */
plugins: [
{
resolve: `gatsby-transformer-asciidoc`,
options: {
safe: 'server',
attributes: {
showtitle: true,
imagesdir: `/images`,
},
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `pages`,
path: `${__dirname}/src`,
},
},
],
}
42 changes: 42 additions & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
exports.createPages = async ({ actions, graphql, reporter }) => {
const { createPage } = actions

const articleTemplate = require.resolve(`./src/templates/article.js`)

const result = await graphql(`
query {
allAsciidoc {
edges {
node {
id
html
document {
title
}
pageAttributes {
slug
}
}
}
}
}
`)

// Handle errors
if (result.errors) {
reporter.panicOnBuild(`Error while running GraphQL query.`)
return
}

result.data.allAsciidoc.edges.forEach(({ node }) => {
createPage({
path: node.pageAttributes.slug,
component: articleTemplate,
context: {
id: node.id,
// additional data can be passed via context
slug: node.pageAttributes.slug,
},
})
})
}
24 changes: 0 additions & 24 deletions markdown/developer.md

This file was deleted.

Loading

0 comments on commit 101b769

Please sign in to comment.