I hereby claim:
- I am elmasse on github.
- I am elmasse (https://keybase.io/elmasse) on keybase.
- I have a public key ASBwebycwQP2p7sgVTrnn8kRBI-Ec4oCraSrIxbv9u_kNQo
To claim this, I am signing this object:
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share} |
{ | |
"presets": ["env"] | |
} |
const fetch = require('isomorphic-fetch') | |
const fm = require('frontmatter') | |
const { readFileSync, statSync } = require('fs') | |
const { resolve, basename, extname, relative, dirname, sep } = require('path') | |
const pathToRegEx = require('path-to-regexp') | |
const parser = require('./parser') | |
module.exports = { | |
source : async ({ extension = 'md', entriesDir = ['posts'], remark = [], rehype = [] } = {}) => { |
//nextein-example/components/post-list-entry.js | |
import React from 'react' | |
import Link from 'nextein/link' | |
import { Content } from 'nextein/post' | |
const countWords = (s) => { | |
s = s.replace(/(^\s*)|(\s*$)/gi,"");//exclude start and end white-space | |
s = s.replace(/[ ]{2,}/gi," ");//2 or more space to 1 | |
s = s.replace(/\n /,"\n"); // exclude newline with a start spacing |
I hereby claim:
To claim this, I am signing this object:
import React, { Component } from 'react' | |
import Router from 'next/router' | |
import { parse, format } from 'url' | |
import raf from 'raf' | |
Router.ready(function() { | |
// monkey patching Router.router | |
const router = Router.router | |
if (!router.__patched) { | |
const _change = router.change |
new Date(post.data.date).toLocaleString(format.locale, format.options) | |
Use toLocaleDateString(); | |
The toLocaleDateString() method returns a string with a language-sensitive representation of the date portion of the date. The locales and options arguments let applications specify the language whose formatting conventions should be used and allow to customize the behavior of the function. | |
The values you can passed in options for different keys: | |
day: | |
The representation of the day. |
const nexteinConfig = require('nextein/config').default | |
const stories = ['food', 'cars'].reduce( (prev, entry) => ({ | |
...prev, | |
[`/${entry}`]: { page: '/stories', query: { category: `stories/${entry}` } } | |
}), {}) | |
module.exports = nexteinConfig({ | |
exportPathMap: () => ({ | |
'/all-posts': { page: '/all-posts' }, |
Sometimes you want to have a subdirectory on the master
branch be the root directory of a repository’s gh-pages
branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master
branch alongside the rest of your code.
For the sake of this example, let’s pretend the subfolder containing your site is named dist
.
Remove the dist
directory from the project’s .gitignore
file (it’s ignored by default by Yeoman).
import Link from 'next/link' | |
const Header = () => ( | |
<div> | |
<Link href='/'> | |
<a>Home</a> | |
</Link> | |
<Link href='/about'> | |
<a>About</a> | |
</Link> |