================================================
FILE: @pauliescanlon/gatsby-theme-terminal/src/utils/index.js
================================================
const IMAGE_KEY = 'image'
export const transformImages = (imageArray) => {
if (Array.isArray(imageArray)) {
return imageArray.reduce((images, image, index) => {
images[`${IMAGE_KEY}${index + 1}`] =
images[`${IMAGE_KEY}${index + 1}`] || image
? image.url
? image.url[0].childImageSharp
: image.childImageSharp
: null
return images
}, {})
}
return {}
}
================================================
FILE: README.md
================================================
## gatsby-theme-terminal
Gatsby Theme Terminal aims to be a **zero component theme**. It provides _data_ components to aid in the abstraction of
presentational and data layers which together provide the most flexibility
The theme handles the data but how it's displayed is up to you!
You can create any page layout or component combination you like using your own components or components provided by
[theme-ui/components](https://theme-ui.com/components)
## 👀 Preview
- [Live Demo](https://gatsbythemeterminal.gatsbyjs.io/)
## 🚀 Getting started
To help you get started you can either clone the starter
[gatsby-starter-terminal](https://github.com/PaulieScanlon/gatsby-starter-terminal) or read the below.
### Install
```
npm install @pauliescanlon/gatsby-theme-terminal
```
### Install Peer Dependencies
```
npm install @mdx-js/mdx @mdx-js/react gatsby gatsby-plugin-mdx gatsby-source-filesystem react react-dom
```
## Setup
### gatsby-config.js
Add the `siteMetaData` and `@pauliescanlon/gatsby-theme-terminal` to your `gatsby-config.js`
```
// gatsby-config.js
module.exports = {
siteMetadata: {
name: "Your blog title",
description: "I like tech",
keywords: ["tech", "blog", "boop"],
siteUrl: 'https://gatsby-theme-terminal.netlify.com',
siteImage: 'name-of-open-graph-image.jpg', // pop an image in the static folder to use it as the og:image,
profileImage: 'name-of-profile-image.jpg'
lang: `eng`,
config: {
sidebarWidth: 240 // optional,
},
},
plugins: ['@pauliescanlon/gatsby-theme-terminal']
}
```
### directory structure
To add pages create `.mdx` files in the `src/pages` directory. You need at least one file called `index.mdx` located at
`src/pages` or you'll see a GraphQL error.
```
|-- src
|-- pages
|-- index.mdx
|-- about.mdx
|-- contact.mdx
```
### frontmatter setup
#### Pages
Pages must include `navigationLabel` in the `frontmatter`
```
// src/pages/about.mdx
---
navigationLabel: About
---
# About
This is about page
```
#### Theme options
Additional `.mdx` can be sourced from _anywhere_ outside the `pages` directory but you need to tell the theme where to
source these files from.
Use the `source` option in `gatsby-config.js`
```
// gatsby-config.js
...
plugins: [
{
resolve: `@pauliescanlon/gatsby-theme-terminal`,
options: {
source: [
{
name: "posts",
dir: "posts",
},
{
name: "projects",
dir: "projects",
},
] // can be an object or array of objects
},
},
],
}
```
Then create the relevant files and directories
```
|-- src
|-- pages
...
|-- posts
|--2020
|--02
|-- some-post.mdx
|-- featuredImage: markus-spiske-466ENaLuhLY-unsplash.jpg
|-- markus-spiske-FXFz-sW0uwo-unsplash.jpg
|-- projects
|-- some-project.mdx
```
Any file that is _not_ sourced from `pages` can contain any of the following `frontmatter` but a `title` is required,
this is how the theme distinguishes between pages and other `.mdx` files
```
// src/posts/2020/02/some-post.mdx
---
title: Some Post
tags: ["JavaScript", "React", "GatsbyJs", "HTML", "CSS", "theme-ui"]
date: 2020-01-01
dateModified: 20-20-2020
author: Paul Scanlon
status: draft // => means it won't be rendered
isPrivate: // => it will be rendered but you can use this prop as a filter
url: "https://example.com" // => could be an external url
misc: "Ahoy" // => use how you wish
pinned: false // => Could be used as a filter for pinned posts
featuredImage: markus-spiske-466ENaLuhLY-unsplash.jpg
featuredImageUrl: https://via.placeholder.com/936x528
embeddedImages:
- markus-spiske-FXFz-sW0uwo-unsplash.jpg
embeddedImageUrls:
- https://via.placeholder.com/468x264
---
```
### Embedded Images
By using the The `` component from `gatsby-plugin-image` you can pass the image data queried by GraphQL
and pass it on via the `image` prop
The `gatsbyImageData`, data is available via `props.embedded.image(n)`
```
```
You can also use the Theme UI `` component by passing it a `src`
```
```
`image1` in this example would be `markus-spiske-FXFz-sW0uwo-unsplash.jpg`
EmbeddedImages can also be sourced from a remote url, in this case use the `` component and pass it the same
props
```
```
### markdown
The theme supports the complete markdown spec and you can see how to use markdown in the
[demo](https://gatsbythemeterminal.gatsbyjs.io/markdown/)
### theme-ui/components
The theme supports _all_ the components provided by [theme-ui/components](https://theme-ui.com/components) and you can
see in the [demo](https://gatsbythemeterminal.gatsbyjs.io/theme-ui-components/) how they are used.
### gatsby-theme-terminal/components
The theme also comes with it's own components _but_... These are purely to provide access to the source nodes. What you
choose to render is completely up to you!
For example to display a list of _all_ files sourced from the `source` theme option you _could_ do something like this.
This component can be used in ANY `.mdx` file 😎
```javascript
{(source) => (
)}
```
You can see more about how to use the theme components in the
[demo](https://gatsbythemeterminal.gatsbyjs.io/components/)
### Component Shadowing
There is very little to shadow because almost everything is exposed by the components but you might want to add your own
logo.
To do this create the following directories `@pauliescanlon/gatsby-theme-terminal/components/Logo` in the `src`
directory of your project and then create a `Logo.js` file. You can do anything you like in here.
```
|-- src
|-- @pauliescanlon
|-- gatsby-theme-terminal
|-- components
|-- Logo
|-- Logo.js
```
If you would like to customize any part of the theme you can do so by shadowing the theme file.
To do this create the following directory `src/gatsby-plugin-theme-ui` and then create an `index.js`
```javascript
// src/gatsby-plugin-theme-ui/index.js
import baseTheme from '@pauliescanlon/gatsby-theme-terminal/src/gatsby-plugin-theme-ui'
export default {
...baseTheme,
colors: {
...baseTheme.colors,
primary: '#FF4081',
secondary: '#03A9F4',
success: '#FFEB3B',
background: '#232323',
surface: '#393939',
},
}
```
### favicon
favicon(s) need to be saved in `static/images` and named `favicon-16x16.png` and `favicon-32x32.png` along with an
`.icon` file called `favicon.ico`
If you're using **gatsby-theme-terminal** in your project i'd love to hear from you
[@pauliescanlon](https://twitter.com/PaulieScanlon)
[](https://ko-fi.com/P5P31B7G8)
================================================
FILE: copy-readme.js
================================================
const fs = require('fs')
fs.copyFile('./README.md', './@pauliescanlon/gatsby-theme-terminal/README.md', (err) => {
if (err) {
throw err
}
console.log('README copied to theme ok!')
})
================================================
FILE: demo/LICENSE
================================================
The MIT License (MIT)
Copyright (c) 2015 gatsbyjs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: demo/README.md
================================================
Gatsby's default starter
Kick off your project with this default boilerplate. This starter ships with the main Gatsby configuration files you might need to get up and running blazing fast with the blazing fast app generator for React.
_Have another more specific idea? You may want to check out our vibrant collection of [official and community-created starters](https://www.gatsbyjs.org/docs/gatsby-starters/)._
## 🚀 Quick start
1. **Create a Gatsby site.**
Use the Gatsby CLI to create a new site, specifying the default starter.
```shell
# create a new Gatsby site using the default starter
gatsby new my-default-starter https://github.com/gatsbyjs/gatsby-starter-default
```
1. **Start developing.**
Navigate into your new site’s directory and start it up.
```shell
cd my-default-starter/
gatsby develop
```
1. **Open the source code and start editing!**
Your site is now running at `http://localhost:8000`!
_Note: You'll also see a second link: _`http://localhost:8000/___graphql`_. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the [Gatsby tutorial](https://www.gatsbyjs.org/tutorial/part-five/#introducing-graphiql)._
Open the `my-default-starter` directory in your code editor of choice and edit `src/pages/index.js`. Save your changes and the browser will update in real time!
## 🧐 What's inside?
A quick look at the top-level files and directories you'll see in a Gatsby project.
.
├── node_modules
├── src
├── .gitignore
├── .prettierrc
├── gatsby-browser.js
├── gatsby-config.js
├── gatsby-node.js
├── gatsby-ssr.js
├── LICENSE
├── package-lock.json
├── package.json
└── README.md
1. **`/node_modules`**: This directory contains all of the modules of code that your project depends on (npm packages) are automatically installed.
2. **`/src`**: This directory will contain all of the code related to what you will see on the front-end of your site (what you see in the browser) such as your site header or a page template. `src` is a convention for “source code”.
3. **`.gitignore`**: This file tells git which files it should not track / not maintain a version history for.
4. **`.prettierrc`**: This is a configuration file for [Prettier](https://prettier.io/). Prettier is a tool to help keep the formatting of your code consistent.
5. **`gatsby-browser.js`**: This file is where Gatsby expects to find any usage of the [Gatsby browser APIs](https://www.gatsbyjs.org/docs/browser-apis/) (if any). These allow customization/extension of default Gatsby settings affecting the browser.
6. **`gatsby-config.js`**: This is the main configuration file for a Gatsby site. This is where you can specify information about your site (metadata) like the site title and description, which Gatsby plugins you’d like to include, etc. (Check out the [config docs](https://www.gatsbyjs.org/docs/gatsby-config/) for more detail).
7. **`gatsby-node.js`**: This file is where Gatsby expects to find any usage of the [Gatsby Node APIs](https://www.gatsbyjs.org/docs/node-apis/) (if any). These allow customization/extension of default Gatsby settings affecting pieces of the site build process.
8. **`gatsby-ssr.js`**: This file is where Gatsby expects to find any usage of the [Gatsby server-side rendering APIs](https://www.gatsbyjs.org/docs/ssr-apis/) (if any). These allow customization of default Gatsby settings affecting server-side rendering.
9. **`LICENSE`**: Gatsby is licensed under the MIT license.
10. **`package-lock.json`** (See `package.json` below, first). This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. **(You won’t change this file directly).**
11. **`package.json`**: A manifest file for Node.js projects, which includes things like metadata (the project’s name, author, etc). This manifest is how npm knows which packages to install for your project.
12. **`README.md`**: A text file containing useful reference information about your project.
## 🎓 Learning Gatsby
Looking for more guidance? Full documentation for Gatsby lives [on the website](https://www.gatsbyjs.org/). Here are some places to start:
- **For most developers, we recommend starting with our [in-depth tutorial for creating a site with Gatsby](https://www.gatsbyjs.org/tutorial/).** It starts with zero assumptions about your level of ability and walks through every step of the process.
- **To dive straight into code samples, head [to our documentation](https://www.gatsbyjs.org/docs/).** In particular, check out the _Guides_, _API Reference_, and _Advanced Tutorials_ sections in the sidebar.
## 💫 Deploy
[](https://app.netlify.com/start/deploy?repository=https://github.com/gatsbyjs/gatsby-starter-default)
================================================
FILE: demo/gatsby-browser.js
================================================
/**
* Implement Gatsby's Browser APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/browser-apis/
*/
// You can delete this file if you're not using it
================================================
FILE: demo/gatsby-config.js
================================================
module.exports = {
siteMetadata: {
name: `gatsby-theme-terminal`,
description: `A zero component Gatsby theme for developers`,
keywords: [`gatsby`, `gatsbyjs`, `gatsby-theme`],
siteUrl: `https://gatsbythemeterminal.gatsbyjs.io`,
siteImage: `https://gatsbythemeterminal.gatsbyjs.io/images/terminal-open-graph-image.jpg`,
profileImage: `https://gatsbythemeterminal.gatsbyjs.io/images/terminal-profile-image.jpg`,
lang: `en`,
config: {
sidebarWidth: 280,
},
},
plugins: [
{
resolve: `@pauliescanlon/gatsby-theme-terminal`,
options: {
source: [
{
name: 'posts',
dir: 'posts',
},
{
name: 'projects',
dir: 'projects',
},
],
},
},
{
resolve: 'gatsby-plugin-google-analytics',
options: {
trackingId: 'UA-76055934-8',
},
},
],
}
================================================
FILE: demo/gatsby-node.js
================================================
/**
* Implement Gatsby's Node APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/node-apis/
*/
// You can delete this file if you're not using it
================================================
FILE: demo/gatsby-ssr.js
================================================
/**
* Implement Gatsby's SSR (Server Side Rendering) APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/ssr-apis/
*/
// You can delete this file if you're not using it
================================================
FILE: demo/package.json
================================================
{
"name": "demo",
"private": true,
"description": "A simple starter using gatsby-theme-terminal",
"version": "0.1.0",
"author": "Paul Scanlon ",
"dependencies": {
"@mdx-js/mdx": "^1.6.22",
"@mdx-js/react": "^1.6.22",
"@pauliescanlon/gatsby-theme-terminal": "*",
"date-fns": "^2.23.0",
"gatsby": "^4.0.0",
"gatsby-plugin-google-analytics": "^4.0.0",
"gatsby-plugin-mdx": "^3.0.0",
"gatsby-source-filesystem": "^4.0.0",
"react": "^17.0.0",
"react-dom": "^17.0.0"
},
"keywords": [
"gatsby"
],
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json}\"",
"start": "npm run develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
},
"browserslist": [
">0.25%",
"not dead",
"IE 11"
]
}
================================================
FILE: demo/src/@pauliescanlon/gatsby-theme-terminal/components/Logo/Logo.js
================================================
/** @jsx jsx */
import { Box, jsx } from 'theme-ui'
import { Link as GatsbyLink } from 'gatsby'
export const Logo = () => (
)
================================================
FILE: demo/src/_temp/source-days.mdx
================================================
---
navigationLabel: SourceDays
---
{(sourceDays) => {
const currentYear = sourceDays[sourceDays.length - 1]
return (
{currentYear
.sort((a, b) => a.number - b.number)
.map((day, index) => {
const { name, count, percent } = day
return (
{name}{`x${count}`}
)
})}
)
}}
================================================
FILE: demo/src/_temp/source-list.mdx
================================================
---
navigationLabel: sourceList
---
{(source) => (
)
}}
## [SourceList](#source-list)
By default the source list returns all `.mdx` found from the directories defined in `gatsby-config.js`. You can also use
the `filter` prop with this component eg: ``
_NOTE:_ the `filter` source _must_ be one from your `gatsby-config.js`
```javascript
{(source) => (
)}
## [SourceDays](#source-days)
By default source days returns an accumulated count and percent of all `frontmatter` date fields grouped by year. You
can also use the `filter` prop with this component eg: ``
_NOTE:_ the `filter` source _must_ be one from your `gatsby-config.js`
```javascript
{(sourceDays) => {
const currentYear = sourceDays[sourceDays.length - 1]
return (
{currentYear
.sort((a, b) => a.number - b.number)
.map((day, index) => {
const { name, count, percent } = day
return (
{name}{`x${count}`}
)
})}
)
}}
```
{(sourceDays) => {
const currentYear = sourceDays[sourceDays.length - 1]
return (
{currentYear
.sort((a, b) => a.number - b.number)
.map((day, index) => {
const { name, count, percent } = day
return (
{name}{`x${count}`}
)
})}
)
}}
## [SourceMonths](#source-months)
By default source months returns an accumulated count and percent of all `frontmatter` date fields grouped by year. You
can also use the `filter` prop with this component eg: ``
_NOTE:_ the `filter` source _must_ be one from your `gatsby-config.js`
```javascript
{(sourceMonths) => {
const currentYear = sourceMonths[sourceMonths.length - 1]
return (
{currentYear[0].year}
{currentYear.map((month, index) => {
const { initial, count, percent } = month
return (
{`x${count}`}
{initial}
)
})}
)
}}
```
{(sourceMonths) => {
const currentYear = sourceMonths[sourceMonths.length - 1]
return (
{currentYear[0].year}
{currentYear.map((month, index) => {
const { initial, count, percent } = month
return (
{`x${count}`}
{initial}
)
})}
)
}}
## [SourceTags](#tag-list)
By default source tags returns all tags found in the `.mdx` sourced from the directories defined in `gatsby-config.js.
You can also use the `filter` prop with this component eg: ``
_NOTE:_ the `filter` source _must_ be one from your `gatsby-config.js``
```javascript
{source => (
{
source.map((tag, index) => {
const {name, count, percent} = tag
return (
{`${name} x${count}`}
})
}
)}
```
{(source) => (
{source.map((tag, index) => {
const { name, count, percent } = tag
return (
{`${name} x${count}`}
)
})}
)}
## [embeddedImages](#embedded-images)
Using a frontmatter field called `embeddedImages` you can define a _list_ of locally sourced images to embed in the
`.mdx` body.
_NOTE:_ this method won't work for `.mdx` sourced from `src/pages`
```javascript
---
title: Post 1
embeddedImages:
- markus-spiske-FXFz-sW0uwo-unsplash.jpg
---
```
You can then use the `` component like this in your `.mdx`.
The `image1` object key refers to the position in the `embeddedImages` list in frontmatter
```javascript
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
```
## [SourceWords](#source-words)
By default source words returns a word count for all words found in the `.mdx` sourced from the directories defined in
`gatsby-config.js.
You can also use the `filter` prop with this component eg: ``
_NOTE:_ the `filter` source _must_ be one from your `gatsby-config.js``
```javascript
{(source) => {
const { wordCountTotal, wordCountAverage, wordCountHighest, wordCountLowest, timeToReadTotal, timeToReadAverage } =
source
return (
Average word count
{wordCountAverage}
Words{`Total words: ${wordCountTotal}`}
)
}}
```
{(source) => {
const { wordCountTotal, wordCountAverage, wordCountHighest, wordCountLowest, timeToReadTotal, timeToReadAverage } =
source
return (
`-${theme.space[2]}px`,
}}
>
Average word count
{wordCountAverage}
Words{`Total words: ${wordCountTotal}`}
Average time to read
{timeToReadAverage}
Minute{`Total read time: ${timeToReadTotal} mins`}
Highest word count
{wordCountHighest}
Words{`Total words: ${wordCountTotal}`}
)
}}
```javascript
{(sourceWords) => {
const currentYear = sourceWords.wordCountByMonth[sourceWords.wordCountByMonth.length - 1]
return (
{currentYear[0].year}
Word count by month
{currentYear.map((month, index) => {
const { initial, words } = month
return (
{`x${words}`}
{initial}
)
})}
)
}}
```
{(sourceWords) => {
const currentYear = sourceWords.wordCountByMonth[sourceWords.wordCountByMonth.length - 1]
return (
{currentYear[0].year}
Word count by month
{currentYear.map((month, index) => {
const { initial, words } = month
return (
{`x${words}`}
{initial}
)
})}
)
}}
================================================
FILE: demo/src/pages/index.mdx
================================================
---
navigationLabel: Home
---
import { format } from 'date-fns'
{(siteMetadata) => {
const { name, description } = siteMetadata
return (
{name}{description}
)
}}
gatsby-theme-terminal
Alert... My website is faster than yours!
## About
Write anything you want in `src/pages/index.mdx` and it'll go here.
## Contact
Email
******@gmail.com
Twitter
https://twitter.com/PaulieScanlon/
GitHub
https://github.com/PaulieScanlon/
LinkedIn
https://linkedin.com/in/PaulieScanlon/
## Top 5 tags
{(tags) => (
{tags
.splice(0, 5)
.sort((a, b) => b.percent - a.percent)
.map((tag, index) => {
const { name, count, percent } = tag
return (
{`${name}`}{percent}%{'['} {']'}
)
})}
)}
================================================
FILE: demo/src/pages/markdown.mdx
================================================
---
navigationLabel: Markdown
---
# [markdown](#markdown)
gatsby-theme-terminal supports the full set of
[markdown shortcodes](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)
## [Heading](#heading)
```markdown
# h1
## h2
### h3
#### h4
##### h5
###### h6
Alternatively, for h1 and h2, an underline-ish style:
# Alt-h1
Alt-h2
```
# h1
## h2
### h3
#### h4
##### h5
###### h6
Alternatively, for h1 and h2, an underline-ish style:
## [Alt-h1](#alt-h1)
Alt-h2
## [Emphasis](#emphasis)
```markdown
Emphasis, aka italics, with _asterisks_ or _underscores_.
Strong emphasis, aka bold, with **asterisks** or **underscores**.
Combined emphasis with **asterisks and _underscores_**.
Strikethrough uses two tildes. ~~Scratch this.~~
```
Emphasis, aka italics, with _asterisks_ or _underscores_.
Strong emphasis, aka bold, with **asterisks** or **underscores**.
Combined emphasis with **asterisks and _underscores_**.
Strikethrough uses two tildes. ~~Scratch this.~~
## [Lists](#lists)
(In this example, leading and trailing spaces are shown with with dots: ⋅)
```markdown
1. First ordered list item
2. Another item
3. Actual numbers don't matter, just that it's a number
4. And another item.
5. Code in list `boop`
- Unordered list can use asterisks
* Or minuses
- Or pluses
```
1. First ordered list item
2. Another item
3. Actual numbers don't matter, just that it's a number
4. And another item.
5. Code in list `boop`
- Unordered list can use asterisks
* Or minuses
- Or pluses
## [Links](#links)
There are two ways to create links.
```markdown
[I'm an inline-style link](https://www.google.com)
[I'm an inline-style link with title](https://www.google.com "Google's Homepage")
[I'm a reference-style link][arbitrary case-insensitive reference text]
[I'm a relative reference to a repository file](../blob/master/LICENSE)
[You can use numbers for reference-style link definitions][1]
Or leave it empty and use the [link text itself].
URLs and URLs in angle brackets will automatically get turned into links. http://www.example.com or
and sometimes example.com (but not on Github, for example).
Some text to show that the reference links can follow later.
[arbitrary case-insensitive reference text]: https://www.mozilla.org
[1]: http://slashdot.org
[link text itself]: http://www.reddit.com
```
[I'm an inline-style link](https://www.google.com)
[I'm an inline-style link with title](https://www.google.com "Google's Homepage")
[I'm a reference-style link][arbitrary case-insensitive reference text]
[I'm a relative reference to a repository file](../blob/master/LICENSE)
[You can use numbers for reference-style link definitions][1]
Or leave it empty and use the [link text itself].
URLs and URLs in angle brackets will automatically get turned into links. http://www.example.com or
and sometimes example.com (but not on Github, for example).
Some text to show that the reference links can follow later.
[arbitrary case-insensitive reference text]: https://www.mozilla.org
[1]: http://slashdot.org
[link text itself]: http://www.reddit.com
## [Images](#images)
```markdown
Here's our logo (hover to see the title text):
Inline-style:

Reference-style: ![alt text][logo]
[logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png 'Logo Title Text 2'
```
Here's our logo (hover to see the title text):
Inline-style:

Reference-style: ![alt text][logo]
[logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png 'Logo Title Text 2'
## [Code and Syntax Highlighting](#code-and-syntax-highlighting)
Code blocks are part of the Markdown spec, but syntax highlighting isn't.
```markdown
Inline `code` has `back-ticks around` it.
```
Inline `code` has `back-ticks around` it.
Blocks of code are either fenced by lines with three back-ticks ```, or are indented with four spaces. I recommend only
using the fenced code blocks -- they're easier and only they support syntax highlighting, but you must provide a
language or none
````markdown
```javascript
var s = 'JavaScript syntax highlighting'
alert(s)
```
```python
s = "Python syntax highlighting"
print s
```
```html
HTML syntax highlighting
```
```none
var s = "JavaScript syntax highlighting"
alert(s)
```
````
```javascript
var s = 'JavaScript syntax highlighting'
alert(s)
```
```python
s = "Python syntax highlighting"
print s
```
```html
HTML syntax highlighting
```
```none
var s = "JavaScript syntax highlighting"
alert(s)
```
## [Tables](#tables)
Tables aren't part of the core Markdown spec, but they are part of GFM and Markdown Here supports them. They are an easy
way of adding tables to your email -- a task that would otherwise require copy-pasting from another application.
```markdown
Colons can be used to align columns.
| Tables | Are | Cool |
| ------------- | :-----------: | -----: |
| col 3 is | right-aligned | \$1600 |
| col 2 is | centered | \$12 |
| zebra stripes | are neat | \$1 |
There must be at least 3 dashes separating each header cell. The outer pipes (|) are optional, and you don't need to
make the raw Markdown line up prettily. You can also use inline Markdown.
| Markdown | Less | Pretty |
| -------- | --------- | ---------- |
| _Still_ | `renders` | **nicely** |
| 1 | 2 | 3 |
```
Colons can be used to align columns.
| Tables | Are | Cool |
| ------------- | :-----------: | -----: |
| col 3 is | right-aligned | \$1600 |
| col 2 is | centered | \$12 |
| zebra stripes | are neat | \$1 |
There must be at least 3 dashes separating each header cell. The outer pipes (|) are optional, and you don't need to
make the raw Markdown line up prettily. You can also use inline Markdown.
| Markdown | Less | Pretty |
| -------- | --------- | ---------- |
| _Still_ | `renders` | **nicely** |
| 1 | 2 | 3 |
## [Blockquotes](#blockquotes)
```markdown
> Blockquotes are very handy in email to emulate reply text. This line is part of the same quote.
Quote break.
> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this
> is long enough to actually wrap for everyone. Oh, you can _put_ **Markdown** into a blockquote.
```
> Blockquotes are very handy in email to emulate reply text. This line is part of the same quote.
Quote break.
> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this
> is long enough to actually wrap for everyone. Oh, you can _put_ **Markdown** into a blockquote.
## [Inline HTML](#inline-html)
You can also use raw HTML in your Markdown, and it'll mostly work pretty well.
```markdown
Definition list
Is something people use sometimes.
Markdown in HTML
Does *not* work **very** well. Use HTML tags.
```
Definition list
Is something people use sometimes.
Markdown in HTML
Does *not* work **very** well. Use HTML tags.
## [Horizontal Rule](#horizontal-rule)
```markdown
Three or more...
---
Hyphens
---
Asterisks
---
Underscores
```
Three or more...
---
Hyphens
---
Asterisks
---
Underscores
## [Line Breaks](#line-breaks)
My basic recommendation for learning how line breaks work is to experiment and discover -- hit `` once (i.e.,
insert one newline), then hit it twice (i.e., insert two new lines), see what happens. You'll soon learn to get what you
want. "Markdown Toggle" is your friend.
```markdown
Here's a line for us to start with.
This line is separated from the one above by two newlines, so it will be a _separate paragraph_.
This line is also a separate paragraph, but... This line is only separated by a single newline, so it's a separate line
in the _same paragraph_.
```
================================================
FILE: demo/src/pages/posts.mdx
================================================
---
navigationLabel: Posts
---
import { format } from 'date-fns'
# posts
You can use the `` component from any `.mdx`.
Here we use it to return all the `posts` by using the filter prop
{(posts) => (
{posts
.filter((edge) => !edge.node.frontmatter.isPrivate)
.reduce((routes, route) => {
return route.node.frontmatter.pinned ? [route, ...routes] : [...routes, route]
}, [])
.map((edge, index) => {
const {
featuredImageUrl,
frontmatter: { title, featuredImage, tags, date, pinned },
excerpt,
fields: { slug },
} = edge.node
return (
{featuredImage ? : null}
{featuredImageUrl ? : null}
{title}
{format(new Date(date), 'd-MMM-u')}{excerpt}View Post
)
})}
)}
================================================
FILE: demo/src/pages/projects.mdx
================================================
---
navigationLabel: Projects
---
import { format } from 'date-fns'
# projects
You can use the `` component from any `.mdx`.
Here we use it to return all the `projects` by using the filter prop
{(projects) => (
{projects
.filter((edge) => !edge.node.frontmatter.isPrivate)
.reduce((routes, route) => {
return route.node.frontmatter.pinned ? [route, ...routes] : [...routes, route]
}, [])
.map((edge, index) => {
const {
featuredImageUrl,
frontmatter: { title, featuredImage, tags, date, pinned },
excerpt,
fields: { slug },
} = edge.node
return (
{featuredImage ? : null}
{featuredImageUrl ? : null}
{title}
{format(new Date(date), 'd-MMM-u')}{excerpt}View Post
)
})}
)}
================================================
FILE: demo/src/pages/theme-ui-components.mdx
================================================
---
navigationLabel: Theme UI
---
# [theme-ui/components](#theme-ui-components)
gatsby-theme-terminal also supports the full set of [theme-ui/components](https://theme-ui.com/components) and below is
how you use them.
If you'd like to see the default theme `.js` that file can be found in
[here](https://github.com/PaulieScanlon/gatsby-theme-terminal/blob/master/%40pauliescanlon/gatsby-theme-terminal/src/gatsby-plugin-theme-ui/index.js)
## [Box](#box)
```javascript
Beep
```
Beep
## [Flex](#flex)
```javascript
Flex
Box
```
Flex
Box
## [Grid](#grid)
```javascript
BoxBox
```
BoxBox
## [Buttons](#buttons)
```javascript
```
## [Text](#text)
```javascript
HelloHelloHello www.example.comHello
```
HelloHello
Hello www.example.com
Hello
## [Heading](#heading)
```javascript
h1h2h3h4h5h6
```
h1
h2
h3
h4
h5
h6
## [Link](#link)
```javascript
Hello
```
Hello
## [Image](#image)
```javascript
```
## [Card](#card)
```javascript
HeadingText
```
HeadingText
## [Forms](#forms)
```javascript
```
## [Label](#label)
```javascript
```
## [Input](#input)
```javascript
```
## [Select](#select)
```javascript
```
## [Textarea](#text-area)
```javascript
```
## [Radio](#radio)
```javascript
```
## [Checkbox](#checkbox)
```javascript
```
## [Slider](#slider)
```javascript
```
## [Field](#field)
```javascript
```
## [Progress](#progress)
```javascript
```
## [Donut](#donut)
```javascript
```
## [Spinner](#spinner)
```javascript
```
## [Avatar](#avatar)
```javascript
```
## [Badge](#badge)
Badges need a variant, the default can't be styled at the moment
```javascript
Beep boop, this is an badge!
Beep boop, this is an badge!
Beep boop, this is an badge!
Beep boop, this is an badge!
```
Beep boop, this is an badge!
Beep boop, this is an badge!Beep boop, this is an badge!
Beep boop, this is an badge!
## [Alert](#alert)
```javascript
Beep boop, this is an alert!
Beep boop, this is an alert!
Beep boop, this is an alert!
Beep boop, this is an alert!
```
Beep boop, this is an alert!
Beep boop, this is an alert!
Beep boop, this is an alert!
Beep boop, this is an alert!
## [Divider](#divider)
```javascript
```
## Embed
```javascript
```
## [AspectRatio](#aspect-ratio)
```javascript
```
## [AspectImage](#aspect-image)
```javascript
```
## [Container](#container)
```javascript
Centered container
```
Centered container
## [NavLink](#nav-link)
```javascript
Home
Blog
About
```
Home
Blog
About
## [Message](#message)
```javascript
This is just a message for someone to read
This is just a message for someone to read
This is just a message for someone to read
This is just a message for someone to read
```
This is just a message for someone to read
This is just a message for someone to read
This is just a message for someone to read
This is just a message for someone to read
## [Close](#close)
```javascript
```
## [IconButton](#icon-button)
```javascript
```
## [MenuButton](#menu-button)
```javascript
```
================================================
FILE: demo/src/posts/2019/03/a-pinned-post.mdx
================================================
---
title: A Pinned Post
tags: ['React', 'TypeScript']
featuredImage: pankaj-patel-SXihyA4oEJs-unsplash.jpg
pinned: true
date: 2019-03-05
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
- [/posts/post-1/](/posts/post-1/)
- [/posts/2020/02/post-5/](/posts/2020/02/post-5/)
- [https://example.com](https://example.com)
- [http://example.com](http://example.com)
## [Dummy Copy](#dummy-copy)
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas dui eros, rhoncus at ex eget, commodo lobortis justo.
Aenean eget aliquam risus. Aenean auctor luctus convallis. Pellentesque tincidunt odio ut risus pretium, id gravida quam
cursus. Quisque at eros facilisis, auctor purus ut, sodales elit. Donec accumsan laoreet enim, ut dictum lacus feugiat
eget. Fusce magna ligula, molestie quis egestas eu, varius eget ante. Suspendisse massa lectus, sollicitudin vel aliquam
at, convallis ac dui.
Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas pellentesque congue
blandit. Etiam facilisis dapibus dolor, vitae semper neque. Phasellus fermentum, odio quis pharetra aliquam, purus justo
gravida risus, a fringilla nisl mi nec dui. Nunc suscipit condimentum fringilla. Duis sit amet porttitor ligula, sed
maximus velit. Sed at lectus diam. Donec malesuada euismod sodales. Etiam pretium gravida feugiat. Donec cursus enim
consequat hendrerit mollis. Quisque ultrices molestie neque et ullamcorper. Aenean fermentum lectus eget ultricies
rutrum. Nullam blandit enim non vulputate dapibus. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Vestibulum finibus mattis feugiat. Vestibulum orci nibh, fermentum at fringilla a, malesuada id lacus. Donec sit amet
mollis odio. Donec condimentum, est ultricies placerat accumsan, ipsum ex varius purus, ut convallis tellus diam in
nisl. Donec gravida hendrerit leo, quis porttitor purus varius eget. Maecenas in lorem velit. Sed feugiat ac velit vitae
tempus. In eget arcu vitae ipsum faucibus pretium sed eu sem. Phasellus nec lorem sollicitudin, vehicula odio in, ornare
quam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aliquam tristique
condimentum ipsum quis pellentesque. Morbi vestibulum id tellus ut tincidunt.
Morbi sit amet pulvinar ex. Etiam aliquam est convallis quam placerat dictum. Sed ligula ante, laoreet sit amet laoreet
quis, semper nec ex. Donec tristique dolor nec maximus sagittis. Duis dictum leo quis volutpat euismod. Praesent porta
felis et sem sodales, scelerisque sollicitudin odio porta. Curabitur ultricies nisl a ligula aliquam porttitor.
Curabitur ligula urna, mattis aliquam dolor nec, scelerisque congue mi.
Duis finibus sagittis tellus at faucibus. Ut sed consequat tellus. Aliquam nec erat dignissim, eleifend lorem sit amet,
elementum felis. Morbi efficitur massa ut turpis facilisis, nec blandit massa cursus. Cras fringilla, ante a dignissim
tincidunt, ligula libero blandit nunc, et egestas lectus tortor eget arcu. Nunc venenatis nibh mauris, quis euismod
lectus congue at. Duis lacinia ligula non est lacinia elementum vitae a ipsum. Mauris et mi nisl. Vivamus facilisis,
lorem at pellentesque dictum, erat nisl malesuada nisl, ac tincidunt dolor magna non libero. Mauris luctus felis vel
magna imperdiet, et molestie est cursus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere
cubilia curae; Fusce vitae mattis nibh. Vestibulum quis augue nunc. Ut fringilla, neque ultrices mattis facilisis, felis
lectus ullamcorper ante, et fermentum lectus justo at nibh.
================================================
FILE: demo/src/posts/2019/post-2.mdx
================================================
---
title: Post 2
tags: ['React', 'GatsbyJs', 'ES6', 'theme-ui']
featuredImage: markus-spiske-70Rir5vB96U-unsplash.jpg
date: 2019-02-17
dateModified: 2019-03-17
author: Paul Scanlon
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi id enim et mauris elementum lobortis.
================================================
FILE: demo/src/posts/2020/01/post-3.mdx
================================================
---
title: Post 3
tags: ['React', 'HTML']
featuredImage: florian-olivo-Ek9Znm8lQ1U-unsplash.jpg
date: 2020-01-17
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
================================================
FILE: demo/src/posts/2020/02/post-4.mdx
================================================
---
title: Post 4
tags: ['React', 'TypeScript']
status: draft
date: 2020-02-12
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
================================================
FILE: demo/src/posts/2020/02/post-5.mdx
================================================
---
title: Post 5
tags: ['React', 'TypeScript', 'GraphQL', 'Fauna']
featuredImage: pankaj-patel-_SgRNwAVNKw-unsplash.jpg
date: 2020-02-12
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Vivamus luctus tincidunt varius. In hac habitasse platea dictumst. Sed eu iaculis velit, in porttitor augue. Ut vitae
sapien vestibulum, bibendum ipsum in, finibus arcu. Vestibulum euismod velit ex, et posuere elit iaculis vel. Donec
sodales imperdiet posuere. Phasellus dui dolor, placerat in elementum vitae, gravida in quam
================================================
FILE: demo/src/posts/2020/04/private.mdx
================================================
---
title: Private
tags: ['React', 'TypeScript', 'GraphQL', 'Fauna']
date: 2020-04-22
isPrivate: true
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Vivamus luctus tincidunt varius. In hac habitasse platea dictumst. Sed eu iaculis velit, in porttitor augue. Ut vitae
sapien vestibulum, bibendum ipsum in, finibus arcu. Vestibulum euismod velit ex, et posuere elit iaculis vel. Donec
sodales imperdiet posuere. Phasellus dui dolor, placerat in elementum vitae, gravida in quam
================================================
FILE: demo/src/posts/2021/local-image-post.mdx
================================================
---
title: Local Image Post
date: 2021-01-14
tags: ['React', 'GatsbyJs', 'ES6', 'Css']
featuredImage: pankaj-patel-SXihyA4oEJs-unsplash.jpg
embeddedImages:
- pankaj-patel-SXihyA4oEJs-unsplash.jpg
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi id enim et mauris elementum lobortis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi id enim et mauris elementum lobortis.
### Gatsby
```javascript
```
``
{JSON.stringify(props.embedded.image1, null, 2)}
### Theme UI
``
{JSON.stringify(props.embedded.image1.gatsbyImageData.images.fallback.src, null, 2)}
================================================
FILE: demo/src/posts/2021/remote-image-post.mdx
================================================
---
title: Remote Image Post
date: 2021-01-13
author: Paul Scanlon
tags: ['JavaScript', 'React', 'GatsbyJs', 'HTML', 'CSS', 'theme-ui']
featuredImageUrl: https://res.cloudinary.com/www-paulie-dev/image/upload/v1603273280/paulie.dev/placeholder_ekfnq2.jpg
embeddedImageUrls:
- https://res.cloudinary.com/www-paulie-dev/image/upload/v1603273280/paulie.dev/placeholder_ekfnq2.jpg
- https://res.cloudinary.com/www-paulie-dev/image/upload/v1603273280/paulie.dev/placeholder_ekfnq2.jpg
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi id enim et mauris elementum lobortis. Donec non tellus
justo. Ut sit amet elit mauris. Praesent eleifend cursus luctus. Praesent posuere rhoncus maximus. Donec nec felis nec
metus semper pharetra ut ut libero. Ut hendrerit dui ut tincidunt egestas. Donec interdum pharetra arcu, vel egestas
turpis ornare a. Phasellus quis euismod diam, sed convallis dolor.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi id enim et mauris elementum lobortis. Donec non tellus
justo. Ut sit amet elit mauris. Praesent eleifend cursus luctus. Praesent posuere rhoncus maximus. Donec nec felis nec
metus semper pharetra ut ut libero. Ut hendrerit dui ut tincidunt egestas. Donec interdum pharetra arcu, vel egestas
turpis ornare a. Phasellus quis euismod diam, sed convallis dolor.
================================================
FILE: demo/src/posts/post-1.mdx
================================================
---
title: Post 1
date: 2020-04-26
dateModified: 2020-05-05
author: Paul Scanlon
tags: ['JavaScript', 'React', 'GatsbyJs', 'HTML', 'CSS', 'theme-ui']
featuredImage: markus-spiske-466ENaLuhLY-unsplash.jpg
embeddedImages:
- markus-spiske-FXFz-sW0uwo-unsplash.jpg
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi id enim et mauris elementum lobortis. Donec non tellus
justo. Ut sit amet elit mauris. Praesent eleifend cursus luctus. Praesent posuere rhoncus maximus. Donec nec felis nec
metus semper pharetra ut ut libero. Ut hendrerit dui ut tincidunt egestas. Donec interdum pharetra arcu, vel egestas
turpis ornare a. Phasellus quis euismod diam, sed convallis dolor.
```sh
npm install aThing `aThing` 'aThing' "aThing"
```
```javascript
```
Donec nec felis nec metus semper pharetra ut ut libero. Ut hendrerit dui ut tincidunt egestas. Donec interdum
pharetra arcu, vel egestas turpis ornare a. Phasellus quis euismod diam, sed convallis dolor.
### [Gatsby](#gatsby)
``
{JSON.stringify(props.embedded.image1, null, 2)}
================================================
FILE: demo/src/projects/2019/project-2.mdx
================================================
---
title: Project 2
tags: ['Automotive', 'FinTech', 'Publishing']
date: 2019-01-29
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi id enim et mauris elementum lobortis. Donec non tellus
justo. Ut sit amet elit mauris. Praesent eleifend cursus luctus. Praesent posuere rhoncus maximus. Donec nec felis nec
metus semper pharetra ut ut libero. Ut hendrerit dui ut tincidunt egestas. Donec interdum pharetra arcu, vel egestas
turpis ornare a. Phasellus quis euismod diam, sed convallis dolor.
================================================
FILE: demo/src/projects/2020/01/project-3.mdx
================================================
---
title: Project 3
tags: ['Automotive']
date: 2020-01-26
url: https://example.com
misc: Ahoy
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi id enim et mauris elementum lobortis. Donec non tellus
justo. Ut sit amet elit mauris. Praesent eleifend cursus luctus. Praesent posuere rhoncus maximus. Donec nec felis nec
metus semper pharetra ut ut libero. Ut hendrerit dui ut tincidunt egestas. Donec interdum pharetra arcu, vel egestas
turpis ornare a. Phasellus quis euismod diam, sed convallis dolor.
================================================
FILE: demo/src/projects/project-1.mdx
================================================
---
title: Project 1
tags: ['Publishing']
date: 2020-02-27
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi id enim et mauris elementum lobortis. Donec non tellus
justo. Ut sit amet elit mauris. Praesent eleifend cursus luctus. Praesent posuere rhoncus maximus. Donec nec felis nec
metus semper pharetra ut ut libero. Ut hendrerit dui ut tincidunt egestas. Donec interdum pharetra arcu, vel egestas
turpis ornare a. Phasellus quis euismod diam, sed convallis dolor.
================================================
FILE: netlify.toml
================================================
[build]
command = "yarn build"
publish = "demo/public"
================================================
FILE: package.json
================================================
{
"private": true,
"scripts": {
"clean": "yarn workspace demo clean",
"serve": "yarn workspace demo serve",
"develop": "yarn workspace demo develop",
"build": "yarn workspace demo build",
"prettier": "prettier --config ./.prettierrc.js --ignore-path ./.prettierignore --write \"**/*.{json,js,ts,tsx,mdx}\"",
"release": "node copy-readme.js && yarn workspace @pauliescanlon/gatsby-theme-terminal publish"
},
"postinstall": "husky install",
"workspaces": [
"@pauliescanlon/gatsby-theme-terminal",
"demo"
],
"devDependencies": {
"@commitlint/cli": "^12.1.4",
"@commitlint/config-conventional": "^12.1.4",
"husky": "^7.0.1",
"prettier": "^2.3.2"
}
}