• Stars
    star
    175
  • Rank 218,059 (Top 5 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Evernote-powered statically-generated blogs and websites

Enwrite Gem Version

What wild heart-histories seemed to lie enwritten
Upon those crystalline, celestial spheres!

β€”Edgar Allan Poe

Evernote-powered statically-generated blogs and websites. Now posting to your blog or updating your website is as easy as writing a new note in Evernote! Post from the Evernote application on any device, use the web clipper, or post by email. Enwrite will pick up the new content and post it automatically!

Still work-in-progress but functional, more docs to come soon.

The first time you run it (or if you use the --auth flag afterward) you will be asked to open an Evernote authentication page, and then to provide the authentication code to Enwrite.

For now it produces output suitable for Hugo. You need to have an existing Hugo install. Output to other blogging/site generator tools is planned for the future through output plugins.

Installation

$ sudo gem install enwrite

Make sure you have Hugo installed: http://gohugo.io/overview/installing/

Getting started

Create a new Hugo site for testing:

$ cd ~/tmp
$ hugo new site my-hugo-blog
$ mkdir my-hugo-blog/themes; git clone https://github.com/zyro/hyde-x.git my-hugo-blog/themes/hyde-x

Populate it with contents from Evernote:

$ enwrite --help
Enwrite v0.2.4

Usage: /usr/local/bin/enwrite [options] (at least one of -n or -s has to be specified)

Search options:
    -n, --notebook NOTEBOOK          Process notes from specified notebook.
    -t, --tag TAG                    Process only notes that have this tag
                                     within the given notebook.
        --remove-tags [t1,t2,t3]     List of tags to remove from output posts.
                                     If no argument given, defaults to --tag.
    -s, --search SEARCHEXP           Process notes that match given search
                                     expression. If specified, --notebook
                                     and --tag are ignored.
Output options:
    -p, --output-plugin PLUGIN       Output plugin to use (Valid values: hugo)
    -o, --output-dir OUTDIR          Base dir of hugo output installation
        --rebuild-all                Process all notes that match the given
                                     conditions (normally only updated notes
                                     are processed)
Other options:
        --auth [TOKEN]               Force Evernote reauthentication (will
                                     happen automatically if needed). Use
                                     TOKEN if given, otherwise get one
                                     interactively.
        --config-tag TAG             Specify tag to determine config notes
                                     (default: _enwrite_config)
    -v, --verbose                    Verbose mode
    -d, --debug                      Debug output mode
        --version                    Show version
    -h, --help                       Shows this help message

Sample usage

Generate posts from all notes tagged published in notebook my_notebook:

$ enwrite -n my_notebook -t published -o ~/tmp/my-hugo-blog
$ cd ~/tmp/my-hugo-blog
$ hugo server --watch

Generate posts from all notes matching some search expression:

$ enwrite -s 'some search expression' -o /tmp/my-hugo-blog

Images, audio and video are embedded in the generated posts (audio and video are done using HTML5 <audio> and <video> tags). Other file types are stored and linked to with their filename.

Special tags

The following tags trigger special behavior if found within the selected notes:

Globally-recognized tags

  • page: publish the note as a page instead of a blog post.

  • post (or none): publish the note as a blog post. This is the default.

  • markdown: store the note as Markdown instead of HTML. Markdown notes can still contain images or other formatting, this will be left untouched inside the Markdown file.

  • _enwrite_config: the contents of the note must be in YAML format and contain configuration parameters to Enwrite (more documentation about this will be written soon). For example, if you wanted blog posts to be stored in the Hugo blog category instead of post, you could include this:

    hugo:
        tag_to_type:
            default: blog/
            post: blog/
            page:
    

Hugo-specific tags

The following tags are recognized by the Hugo output plugin (the only one available at the moment):

  • _enwrite_files_hugo: text in these notes is ignored, but any attachments are stored under the Hugo output directory. .tar.gz files will be unpacked under that directory, all others will be stored as-is. You can use this to have Hugo config files, themes, static contents or anything else automatically installed by Enwrite as well. Please note that any "files" notes must also be included in the selection criteria specified by -n, -t or -s (e.g. if you are using -t published, your files notes must also be tagged published or they will be ignored).

    Any text in files notes will be ignored, so you can use it to make it human-readable. For example, I have the following note in the notebook that powers http://zzamboni.org/new/, so I can start from a plain Hugo site and have it fully customized after running enwrite:

    Files note screenshot

  • Any tags of the form _foo=bar are inserted into the frontmatter for the generated posts as field foo with value bar. This might be used to add information (e.g. a custom slug, specify weight for ordeing of pages, or any other field which may control the behavior or output produced.

Other tags

All the special tags described above are removed from the post before publishing (you can configure additional ones to remove with the --remove-tags option). All other tags are passed through to the produced posts. Of course, you could have some of those tags also trigger special behavior within the output system. For example, my custom Hyde-X Hugo theme recognizes the following tags:

  • _home: set this page as the default for the site.
  • _menu=main: add this page to the top-level navigation menu.

Shortcuts

Shortcuts are of the form [shortcutname params]. The following shortcuts are currently recognized:

  • Embed Youtube video by URL or ID. You can optionally specify width and height. All arguments must be enclosed in double quotes.
[youtube url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"]
[youtube src="https://www.youtube.com/watch?v=dQw4w9WgXcQ"]
[youtube id="dQw4w9WgXcQ" width="640px" height="480px"]
  • Embed gist.
[gist url="https://gist.github.com/zzamboni/843142d3f759e582fe8f"]

Planned features/fixes

enhancement

Bugs, feature requests, feedback or other issues?

Please open a Github issue.

More Repositories

1

dot-hammerspoon

My personal Hammerspoon configuration - mirrored from GitLab
Lua
229
star
2

dot-doom

My Doom Emacs config files. Mirrored from https://gitlab.com/zzamboni/dot-doom
Emacs Lisp
115
star
3

dot-emacs

My Emacs configuration files - mirrored from GitLab
Emacs Lisp
81
star
4

elvish-modules

Various modules for Elvish
Elvish
77
star
5

dot-elvish

My configuration files for elvish - mirrored from GitLab
Elvish
48
star
6

elvish-completions

Completer definitions for Elvish
44
star
7

emacs-org-leanpub

Source code for "Publishing with Emacs, Org-mode and Leanpub"
Emacs Lisp
32
star
8

ox-leanpub

Org-mode exporter for Leanpub books - mirrored from GitLab
Emacs Lisp
26
star
9

elvish-themes

Prompt themes for Elvish
19
star
10

hammerspoon-config

My config files for Hammerspoon (http://www.hammerspoon.org)
Lua
13
star
11

750words-client

A command-line client for 750words.com.
Emacs Lisp
12
star
12

vita

Source for my CV - mirrored from https://gitlab.com/zzamboni/vita
TeX
11
star
13

things2thl

Things-to-The Hit List converter
Ruby
10
star
14

grabcartoons

GrabCartoons is a comic-summarizing utility. It is modular, and it is very easy to write modules for new comics.
Perl
10
star
15

zzSpoons

Unofficial repository of Spoons for Hamerspoon
Python
9
star
16

cf-learn.info-old

Web page and code samples for book "Learning CFEngine 3"
PHP
6
star
17

copperexport

iPhoto plugin for exporting to a Coppermine gallery
Objective-C
4
star
18

elvish-installer

3
star
19

ob-elvish

Org Babel support for Elvish
Emacs Lisp
2
star
20

cf-learn.info

Website for "Learning CFEngine 3"
CSS
2
star
21

plugin-cdb

cd to basename
Shell
2
star
22

zzamboni.org

Source for zzamboni.org - mirrored from https://gitlab.com/zzamboni/zzamboni.org.
HTML
2
star
23

spoon

Manipulate Hammerspoon Spoons
Shell
1
star
24

zzamboni.org-oldgithub

Contents of zzamboni.org
HTML
1
star
25

plugin-notify

A plugin for Oh My Fish to print different types of messages to the console
Shell
1
star
26

firefox-ssb

Create an SSB based on Firefox
Shell
1
star
27

styles

Templates and style for my web pages
1
star
28

leanpub-orb

CircleCI orb for automating Leanpub book preview/publishing
1
star