1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-12-22 17:23:50 +01:00

add markdownlint

This commit is contained in:
Matthias Kretschmann 2018-09-24 01:09:50 +02:00
parent 8cadf6df4a
commit 875fcc304f
Signed by: m
GPG Key ID: 606EEEF3C479A91F
8 changed files with 73 additions and 10 deletions

8
.markdownlint.json Normal file
View File

@ -0,0 +1,8 @@
{
"default": true,
"line_length": false,
"no-inline-html": false,
"fenced-code-language": false,
"first-line-h1": false,
"first-heading-h1": false
}

View File

@ -31,7 +31,6 @@ They are completely styled with CSS3 so they're sharp on all screens no matter h
## Usage
### CSS
Just drop in the `kbdftw.css` in your `head`:
@ -62,6 +61,7 @@ The default styling are light keys with Lucida Grande as font:
```html
<kbd>Q</kbd>
```
becomes <kbd>Q</kbd>
Add a dark class to get the dark keys:
@ -69,6 +69,7 @@ Add a dark class to get the dark keys:
```html
<kbd class="dark">Q</kbd>
```
becomes <kbd class="dark">Q</kbd>
Adding an ios or android class gives a replica of those system keys. Android uses three different colors on the default keyboard.
@ -76,21 +77,25 @@ Adding an ios or android class gives a replica of those system keys. Android use
```html
<kbd class="ios">Q</kbd>
```
becomes <kbd class="ios">Q</kbd>
```html
<kbd class="android">Q</kbd>
```
becomes <kbd class="android">Q</kbd>
```html
<kbd class="android dark">Q</kbd>
```
becomes <kbd class="android dark">Q</kbd>
```html
<kbd class="android color">Q</kbd>
```
becomes <kbd class="android color">Q</kbd>
I've let the default `display: inline` intact so all padding on the `kbd` elements won't affect the line-height of the surrounding text. This leads to problems when you want to use them over multiple lines so just make them `display: inline-block` in this scenario.

View File

@ -1,8 +1,6 @@
require('./src/styles/global.scss')
import './src/styles/global.scss'
exports.onClientEntry = () => {
// IntersectionObserver polyfill for gatsby-image (Safari, IE)
if (typeof window.IntersectionObserver === 'undefined') {
require('intersection-observer')
}
import('intersection-observer')
}

View File

@ -13,10 +13,12 @@
"format:css": "prettier-stylelint --write --quiet 'src/**/*.{css,scss}'",
"lint:js": "eslint ./gatsby-*.js && eslint ./src/**/*.jsx",
"lint:css": "stylelint ./src/**/*.{css,scss}",
"lint": "npm run svg && npm run lint:js && npm run lint:css",
"lint:md": "markdownlint ./content/posts/**/*.md && markdownlint ./README.md",
"lint": "npm run svg && npm run lint:md && npm run lint:js && npm run lint:css",
"test": "npm run lint",
"deploy": "./scripts/deploy.sh",
"svg": "./scripts/svg.sh"
"svg": "./scripts/svg.sh",
"new": "babel-node ./scripts/new.js"
},
"browserslist": [
"last 3 versions"
@ -65,6 +67,8 @@
"slugify": "^1.3.1"
},
"devDependencies": {
"@babel/node": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@svgr/cli": "^2.4.1",
"babel-eslint": "^9.0.0",
"eslint": "^5.6.0",
@ -73,6 +77,8 @@
"eslint-plugin-graphql": "^2.1.1",
"eslint-plugin-prettier": "^2.6.2",
"eslint-plugin-react": "^7.11.1",
"markdownlint": "^0.11.0",
"markdownlint-cli": "^0.13.0",
"prettier": "^1.14.3",
"prettier-stylelint": "^0.4.2",
"stylelint": "^9.5.0",

3
scripts/.babelrc Normal file
View File

@ -0,0 +1,3 @@
{
"presets": ["@babel/env"]
}

30
scripts/new.js Normal file
View File

@ -0,0 +1,30 @@
import fs from 'fs'
import path from 'path'
import prepend from 'prepend'
import slugify from 'slugify'
import ora from 'ora'
const templatePath = path.join(__dirname, 'new.md')
const template = fs.readFileSync(templatePath).toString()
const spinner = ora('Adding new project').start()
if (!process.argv[2]) {
spinner.fail('Use the format `npm run new -- Title of post`')
}
const title = process.argv[2]
spinner.text = `Adding '${title}'.`
const titleSlug = slugify(title, { lower: true })
const postsPath = path.join(__dirname, 'content', 'posts')
const newContents = template
.split('TITLE')
.join(title)
.split('DATE')
.join(Date.now())
// prepend(projects, newContents, error => {
// if (error) spinner.fail(error)
// spinner.succeed(`Added '${title}' to top of projects.yml file.`)
// })

13
scripts/new.md Normal file
View File

@ -0,0 +1,13 @@
---
type: post
title: TITLE
author: Matthias Kretschmann
date: DATE
tags:
- tag
---
Beep Boop.