Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit af4d60c
Showing
20 changed files
with
7,059 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) EGOIST <0x142857@gmail.com> (https://github.com/egoist) | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
working_directory: ~/repo | ||
docker: | ||
- image: circleci/node:latest | ||
branches: | ||
ignore: | ||
- gh-pages # list of branches to ignore | ||
- /release\/.*/ # or ignore regexes | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
key: dependency-cache-{{ checksum "yarn.lock" }} | ||
- run: | ||
name: install dependences | ||
command: yarn | ||
- save_cache: | ||
key: dependency-cache-{{ checksum "yarn.lock" }} | ||
paths: | ||
- ./node_modules | ||
- run: | ||
name: test | ||
command: yarn test |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# DOCUP | ||
|
||
## Introduction | ||
|
||
Docup is a single script that you can use to create a beautiful one-page documentation without build process. | ||
|
||
The idea is inpired by my another project ([Docute](https://docute.js.org)) which in turns is inspired by [Flatdoc](http://ricostacruz.com/flatdoc/). And the design is inspired by [tj (TJ Holowaychuk)](https://github.com/tj)'s wonderful docs for [Apex Up](https://up.docs.apex.sh). | ||
|
||
## Usage | ||
|
||
Create an HTML file: `index.html` which will be be homepage of your documentation website: | ||
|
||
```html | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" /> | ||
<title>My Awesome Doc</title> | ||
<!-- Stylesheet --> | ||
<link rel="stylesheet" href="https://unpkg.com/@rem/docup/dist/docup.css"> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<!-- Script --> | ||
<script src="https://unpkg.com/@rem/docup/dist/docup.js"></script> | ||
<!-- Start app --> | ||
<script> | ||
var doc = new Docup() | ||
doc.start('#app') | ||
</script> | ||
</body> | ||
</html> | ||
``` | ||
|
||
Then populate a `README.md` file to the same directory where `index.html` is located. | ||
|
||
```md | ||
# My Project | ||
|
||
## Introduction | ||
|
||
How about this. | ||
|
||
## Advanced | ||
|
||
How about that. | ||
``` | ||
|
||
Finally serve this directory as a static website: | ||
|
||
- node.js: `npm i -g serve` && `serve ./docs` | ||
- python: `cd ./docs` && `python -m SimpleHTTPServer` | ||
- golang: `cd ./docs` && `caddy` | ||
- ...etc, you can use any static file server, for real. | ||
|
||
## Deploy | ||
|
||
### GitHub Pages | ||
|
||
Simply put all your files in `docs` folder on `master` branch, or root directory on the `gh-pages` branch. | ||
|
||
Don't forget to `.nojekyll` file to tell GitHub to treat it as a normal static website. | ||
|
||
## API | ||
|
||
### Constructor | ||
|
||
```js | ||
const doc = new Docup(options) | ||
``` | ||
|
||
#### options | ||
|
||
##### indexFile | ||
|
||
Type: `string`<br> | ||
Default: `README.md` | ||
|
||
##### root | ||
|
||
Type: `string`<br> | ||
Default: `./` | ||
|
||
##### highlight | ||
|
||
Type: `boolean` `function`<br> | ||
Default: `true` | ||
|
||
Whether to highlight code blocks, you can supply a function to customize this: | ||
|
||
```js | ||
function highlight(code, lang) {} | ||
``` | ||
|
||
#### doc.start(target) | ||
|
||
##### target | ||
|
||
Type: `string` `HTMLElement` | ||
|
||
The place to mount app to. | ||
|
||
## License | ||
|
||
MIT © EGOIST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"/> | ||
<title><%= htmlWebpackPlugin.options.title %></title> | ||
<% if (htmlWebpackPlugin.options.description) { %> | ||
<meta name="description" content="<%= htmlWebpackPlugin.options.description %>"/> | ||
<% } %> | ||
</head> | ||
<body> | ||
<noscript> | ||
You need to enable JavaScript to run this app. | ||
</noscript> | ||
<div id="app"></div> | ||
<script src="/client.js"></script> | ||
<script> | ||
const doc = new Docup({ | ||
root: '/docs/' | ||
}) | ||
doc.start('#app') | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const path = require('path') | ||
const express = require('express') | ||
|
||
module.exports = { | ||
entry: 'src/index.js', | ||
jsx: 'h', | ||
html: { | ||
template: path.join(__dirname, 'index.ejs'), | ||
inject: false | ||
}, | ||
vendor: false, | ||
presets: [ | ||
require('poi-preset-bundle-report')() | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" /> | ||
<title>Docup</title> | ||
<!-- Stylesheet --> | ||
<link rel="stylesheet" href="https://unpkg.com/@rem/docup/dist/docup.css"> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<!-- Script --> | ||
<script src="https://unpkg.com/@rem/docup/dist/docup.js"></script> | ||
<!-- Start app --> | ||
<script> | ||
var doc = new Docup() | ||
doc.start('#app') | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = function (input, options = {}) { | ||
if (typeof input !== 'string') { | ||
throw new TypeError('Expected input to be string') | ||
} | ||
|
||
return `${input} & ${options.postfix || 'rainbow'}` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"name": "@rem/docup", | ||
"version": "0.0.0", | ||
"description": "Simple yet elegant docs.", | ||
"repository": { | ||
"url": "https://github.com/egoist/docup.git", | ||
"type": "git" | ||
}, | ||
"main": "dist/docup", | ||
"files": [ | ||
"dist" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"scripts": { | ||
"test": "npm run lint && echo 'no tests!'", | ||
"lint": "xo", | ||
"dev": "poi -c docs/dev/poi.config.js", | ||
"build": "poi build -c docs/dev/poi.config.js --component Docup" | ||
}, | ||
"author": "egoist <0x142857@gmail.com>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"marked3": "^0.5.1", | ||
"preact": "^8.2.6", | ||
"prismjs": "^1.8.4", | ||
"slugo": "^0.2.1", | ||
"unfetch": "^3.0.0", | ||
"vue": "^2.5.9", | ||
"vue-router": "^3.0.1" | ||
}, | ||
"devDependencies": { | ||
"eslint-config-rem": "^3.0.0", | ||
"express": "^4.16.2", | ||
"poi": "^9.5.5", | ||
"poi-preset-bundle-report": "^2.0.2", | ||
"vue-template-compiler": "^2.5.9", | ||
"xo": "^0.18.0" | ||
}, | ||
"xo": { | ||
"extends": "rem" | ||
} | ||
} |
Oops, something went wrong.