github.com/titpetric/pendulum@v0.1.180207-1512.0.20180514135826-1f399445df57/README.md (about)

     1  # Pendulum
     2  
     3  A simple editor for markdown/txt files. Supports saving changes into git repositories hosted anywhere (git add, git commit).
     4  
     5  [Docker image](https://hub.docker.com/r/titpetric/pendulum) and [built binaries](https://github.com/titpetric/pendulum/releases) are provided.
     6  Written by [@TitPetric](https://twitter.com/TitPetric) and licensed under the permissive [WTFPL](http://www.wtfpl.net/txt/copying/).
     7  
     8  [![Codeship Status for titpetric/pendulum](https://app.codeship.com/projects/88ecf220-6806-0135-7d43-4a6204a3e72a/status?branch=master)](https://app.codeship.com/projects/241162)
     9  
    10  ## Running it in docker
    11  
    12  To run it in Docker:
    13  
    14  ~~~
    15  docker run -d --name pendulum \
    16  	--restart=always \
    17  	-p 8080:8080 \
    18  	-v $(pwd):/app/contents \
    19  	titpetric/pendulum
    20  ~~~
    21  
    22  This will expose your current directory to Pendulum for editing. You can open the interface on
    23  [http://localhost:8080/](http://localhost:8080/) and start editing those files right away.
    24  
    25  ## Download executable
    26  
    27  There are binaries for 64bit Linux and Windows available on [the releases page](https://github.com/titpetric/pendulum/releases/latest).
    28  Usage is simple. Download the .tgz file, unpack the binary and run it with any options like this:
    29  
    30  ~~~
    31  # ./pendulum -?
    32  flag provided but not defined: -?
    33  Usage of pendulum:
    34    -addr string
    35          Address for server (default ":8080")
    36    -contents string
    37          Folder for display (default ".")
    38  ~~~
    39  
    40  If you want to serve contents of a `test` folder on port 8081 you would run it as:
    41  
    42  ~~~
    43  ./pendulum -addr :8081 -contents test
    44  ~~~
    45  
    46  It's also supported to pass the contents folder as a normal argument. This is the shortest way
    47  of starting pendulum serving a custom folder: `./pendulum folder`.
    48  
    49  ## Screenshot
    50  
    51  ![](images/pendulum.png)
    52  
    53  As you write or scroll either the textarea or the preview pane, the scroll positions are synchronised
    54  based on percentage. In case of images in the text, accuracy can be quite off, but it's possible to
    55  improve this behaviour in the future.
    56  
    57  Most of the development is basically related with the preview of whatever it is you're
    58  editing. The editor itself doesn't care about anything other than the contents of the text
    59  file you're opening and trying to save.
    60  
    61  ## Thanks
    62  
    63  If you want to thank me, please consider buying a book or three:
    64  
    65  - [API Foundations in Go](https://leanpub.com/api-foundations)
    66  - [12 Factor Applications with Docker and Go](https://leanpub.com/12fa-docker-golang)
    67  - [The SaaS Handbook](https://leanpub.com/saas-handbook)
    68  
    69  This project exists only because of the last book on the list.
    70  
    71  ## Why did I make this?
    72  
    73  There's a distinct lack of friendly solutions that just let you point to a folder and edit a bunch
    74  of text or markdown files. I wrote about three books on Leanpub (see above), and it was useful to
    75  provide me with a way to review those markdown files. I'm also blogging with Hugo, used to blog with
    76  Hexo, have some Jekyll files for my GitHub page, and I tend to write documentation with MkDocs.
    77  That's about five systems which I actively write content into and those are just the public ones.
    78  
    79  ## How is it made?
    80  
    81  There's a very simple API that powers the editor. The API provides exactly three calls:
    82  
    83  1. `/api/list` - lists folders and files for navigation,
    84  2. `/api/read` - reads a single file for editing,
    85  3. `/api/store` - stores a single file contents (can create new files)
    86  
    87  It operates exclusively on the `contents` folder and the files you provide in there. The editor
    88  doesn't care what kind of files you put there, currently only files starting with a dot are excluded,
    89  ie, `.git`, `.gitignore`,...
    90  
    91  ## Go server + API
    92  
    93  A full HTTP server is implemented with Go. By default it listens on port 8080, but it's trivial
    94  to change this, just by passing the `-addr` option when you run it.
    95  
    96  ~~~
    97  go run *.go -addr :80
    98  ~~~
    99  
   100  > **Note**: Pendulum supports git versioning. It does require you to set git config for `user.name`
   101  > and `user.email`. Without those, Pendulum will not add/commit files, regardless if a git repository
   102  > is present or not.
   103  
   104  
   105  ## Special syntax
   106  
   107  | Software | Type | Syntax | Support |
   108  | -------- | ---- | ------ | ------- |
   109  | Leanpub | Citation | `A> Note` | Yes |
   110  | Leanpub | Pagebreak | `{pagebreak}` | Yes |
   111  | Hugo | Pagebreak | `<!--more-->` | Yes |
   112  | Hexo | Image | [asset_img](https://hexo.io/docs/asset-folders.html) | Yes |
   113  
   114  I'm trying to add new features here. Feel free to submit a PR if there's a syntax you'd like to support, with the appropriate tests under `front/src/markdown/*`.
   115  
   116  ## Status
   117  
   118  - [x] Full API for list, read and store,
   119  - [x] Navigation of folders and files on the front-end,
   120  - [x] Editor component with synchronised scrolling with preview,
   121  - [x] Marked preview,
   122  - [ ] (partially done) Add support for some of Leanpub syntax (`A>`, page break,...),
   123  - [ ] Add support for some of Hugo syntax (`<!--more-->`, metadata, ...),
   124  - [x] Actually save the contents that are being edited (client-side ajax),
   125  - [x] Check if git has user.name && user.email set before commiting with git
   126  - [x] Add git support to Go API
   127  - [ ] Add option for HTTP auth
   128  - [x] Deprecate/remove PHP API
   129  - [x] Support images with relative links in rendering
   130  - [x] Display images from preview markdown pane
   131  - [ ] More markdown styling (done: blockquote, code, image, needs: tables,...)
   132  - [x] Docker image for delivery
   133  - [x] Go server for delivery
   134  - [x] Git support from Go / Docker
   135  - [x] Codeship CI,
   136  - [x] Semver (sort of),
   137  - [x] Pack public_html data into release binary
   138  - [x] Downloadable builds on GitHub
   139  - [x] Windows build
   140  - [x] Create new files over front-end interface
   141  
   142  I guess unit testing should be somewhere on the list, if this thing ever gets any traction.