Improve documentation

This commit is contained in:
Trevor Slocum 2019-09-04 17:49:41 -07:00
parent 7313ce5bd7
commit 04e64762ce
9 changed files with 165 additions and 96 deletions

View File

@ -1,3 +1,6 @@
0.1.3:
- Allow notebooks to be served publicly
0.1.2:
- Add note options interface
- Add option to show dismissed list items

91
CONFIGURATION.md Normal file
View File

@ -0,0 +1,91 @@
# Notebook initialization
stick notebooks are [git repositories](https://git-scm.com/book/en/v2/Getting-Started-What-is-Git%3F) containing [Markdown](https://www.markdownguide.org/) formatted text files.
Note that while stick uses git, it is not required to have git installed.
Initialize one or more notebooks, specifying where the repository should be created.
If you would like to use an existing git repository, you may skip this step.
```
stick init /home/stick/notes/johnsnotes
```
# Configuring stick.yml
stick is configured via ~/.config/stick/stick.yml (or elsewhere when specified with the --config flag)
## salt
Used when hashing data (set to a random string)
## serve
Serve notebooks on this address (host:port)
## authors
List of authors, specified by email and name
## notebooks
List of notebooks, specified by label. Options include:
### repo
Path to git repository
### serve
List of authors (specified by email) and their access level, which is one of the following:
- read
- write
Including an author named "public" will share the notebook publicly.
# Example stick.yml
```yaml
# Used when hashing data (set to a random string)
salt: xXxsh3cr3txXx
# Serve notes on localhost only
# Set to :9991 to serve on all interfaces (not recommended, use a reverse proxy instead)
serve: localhost:9991
# Authors are defined by email and name (used when committing)
authors:
john@hotmail.com: John Doe
jane@aol.com: Jane Doe
# Notebooks can be shared between authors with varying access levels
# When an access level isn't specified, read-only is assumed
# John's notebook allows read/write access to himself and read-only access to Jane
notebooks:
John's notes:
repo: /home/stick/notes/johnsnotes
serve:
- john@hotmail.com: write
- jane@aol.com
Jane's notes:
repo: /home/stick/notes/janesnotes
serve:
- jane@aol.com: write
- john@hotmail.com
Shared notes:
repo: /home/stick/notes/shared
serve:
- john@hotmail.com: write
- jane@aol.com: write
Public notes:
repo: /home/stick/notes/public
serve:
- john@hotmail.com: write
- jane@aol.com: write
- public
```

42
OPTIONS.md Normal file
View File

@ -0,0 +1,42 @@
stick allows note display and behavior to be customized.
# Options directive
Note options are specified with the **options directive**:
```
[//]: # (list,sort)
* [ ] Eggs
* [ ] Flour
* [X] Milk
```
This directive must be the first line of the note. When using the web interface
to change note options, this directive will be added and updated automatically.
(You do not need to memorize it.)
**Note:** When viewing this documentation in a rendered format, the directive will
not be visible. It is shown below with an added space before the colon.
```
[//] : # (list,sort)
```
# Available options
#### Pin
Pinned notes will appear in another notebook labeled "Pinned"
#### List
Emphasize and remove duplicate list items
#### Sort
Sort list items alphabetically
#### Dismissed
Show dismissed list items

View File

@ -5,6 +5,12 @@
Shareable Git-backed Markdown-formatted notes
## Features
- Notebooks are standard git repositories containing .md files
- Notebooks may be used privately, shared with one or more users privately, or shared publicly
- Notes may be customized (e.g., to-do style lists with automatic sorting and de-duplication)
## Demo
[**Try stick**](https://stick.rocketnine.space/#login/c89f5381659ad34bd84967fdbbb5e76834495063dc93ed3902bf4e186f4def90)
@ -17,7 +23,9 @@ Choose one of the following methods:
### Download
[**Download stick**](https://stick.rocketnine.space/download/) (Windows and Linux binaries are available)
[**Download stick**](https://stick.rocketnine.space/download/)
Windows and Linux binaries are available.
### Compile
@ -27,49 +35,7 @@ GO111MODULE=on go get -u git.sr.ht/~tslocum/stick
## Configure
Initialize a notebook by creating an empty git repository:
```
stick init /home/stick/notes/johnsnotes
```
Configure stick via ~/.config/stick/stick.yml (or elsewhere by using --config later)
```yaml
# Used when hashing data (set to a random string)
salt: xXxsh3cr3txXx
# Serve notes on localhost only
# Set to :9991 to serve on all interfaces (not recommended, use a reverse proxy instead)
serve: localhost:9991
# Authors are defined by email and name (used when committing)
authors:
john@hotmail.com: John Doe
jane@aol.com: Jane Doe
# Notebooks can be shared between authors with varying access levels
# When an access level isn't specified, read/write is assumed
# John's notebook allows read/write access to himself and read-only access to Jane
notebooks:
John's notes:
repo: /home/stick/notes/johnsnotes
serve:
- john@hotmail.com
- jane@aol.com: read
Jane's notes:
repo: /home/stick/notes/janesnotes
serve:
- jane@aol.com
- john@hotmail.com: read
Shared notes:
repo: /home/stick/notes/shared
serve:
- john@hotmail.com
- jane@aol.com
```
See [CONFIGURATION.md](https://man.sr.ht/~tslocum/stick/CONFIGURATION.md)
## Run
@ -77,38 +43,9 @@ notebooks:
stick serve
```
### Options
## Customize
Note display and behavior can be customized via the **options directive**:
```
[//]: # (list,sort)
* [ ] Eggs
* [ ] Flour
* [X] Milk
```
This directive must be the first line of the note. When using the web interface
to change note options, this directive will be added and updated automatically.
The following options are available:
#### Pin
Pinned notes will appear in another notebook labeled "Pinned"
#### List
Emphasize and remove duplicate list items
#### Sort
Sort list items alphabetically
#### Dismissed
Show dismissed list items
See [OPTIONS.md](https://man.sr.ht/~tslocum/stick/OPTIONS.md)
## Support

View File

@ -1,9 +0,0 @@
package main
import "net"
func connectToBranch() {
c, err := net.Dial("unix", "/tmp/branch.sock")
CheckError(err)
defer c.Close()
}

1
cli.go
View File

@ -1 +0,0 @@
package main

View File

@ -27,7 +27,7 @@ notebooks:
repo: /home/stick/repo/b
serve:
- check@stick.rocketnine.space: check
- write@stick.rocketnine.space
- read@stick.rocketnine.space
`)
c, err := ReadConfigData(configData)
@ -44,6 +44,6 @@ notebooks:
c.Authors)
assert.ElementsMatch(t, []*NotebookConfig{
{Label: "Test Notebook A", Repo: "/home/stick/repo/a", Serve: map[string]int{"read@stick.rocketnine.space": AuthorAccessRead, "write@stick.rocketnine.space": AuthorAccessWrite}},
{Label: "Test Notebook B", Repo: "/home/stick/repo/b", Serve: map[string]int{"check@stick.rocketnine.space": AuthorAccessCheck, "write@stick.rocketnine.space": AuthorAccessWrite}}},
{Label: "Test Notebook B", Repo: "/home/stick/repo/b", Serve: map[string]int{"check@stick.rocketnine.space": AuthorAccessCheck, "read@stick.rocketnine.space": AuthorAccessRead}}},
c.Notebooks)
}

8
go.mod
View File

@ -7,12 +7,14 @@ require (
github.com/daaku/go.zipexe v1.0.1 // indirect
github.com/google/go-cmp v0.3.1 // indirect
github.com/gorilla/mux v1.7.3
github.com/gorilla/websocket v1.4.0
github.com/gorilla/websocket v1.4.1
github.com/pkg/errors v0.8.1
github.com/stretchr/testify v1.4.0
github.com/urfave/cli v1.21.0
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // indirect
golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472 // indirect
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 // indirect
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/src-d/go-git.v4 v4.13.1
gopkg.in/yaml.v2 v2.2.2
)

16
go.sum
View File

@ -28,8 +28,8 @@ github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
@ -70,18 +70,20 @@ golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnf
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472 h1:Gv7RPwsi3eZ2Fgewe3CBsuOebPwO27PoXzRpJPsvSSM=
golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 h1:fHDIZ2oxGnUZRN6WgWFCbYBjH9uqVPRCUVUDhs0wnbA=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM=
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd h1:DBH9mDw0zluJT/R+nGuV3jWFWLFaHyYZWD4tOT+cjn0=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
@ -90,6 +92,8 @@ golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a/go.mod h1:jcCCGcm9btYwXyDq
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/src-d/go-billy.v4 v4.3.2 h1:0SQA1pRztfTFx2miS8sA97XvooFeNOmvUenF4o0EcVg=
gopkg.in/src-d/go-billy.v4 v4.3.2/go.mod h1:nDjArDMp+XMs1aFAESLRjfGSgfvoYN0hDfzEk0GjC98=
gopkg.in/src-d/go-git-fixtures.v3 v3.5.0 h1:ivZFOIltbce2Mo8IjzUHAFoq/IylO9WHhNOAJK+LsJg=