Git Product home page Git Product logo

hem2md's Introduction

Hemingway Editor to MD

Ming Vase license - if it breaks you get to keep the pieces. No awards will be won for this work.

Yes I know, the Hemingway Editor will output to markdown, but you have to do it every time. And if you are like me, you might want to use the output in a different system (e.g. Leanpub). This convertor will parse a Hemingway Editor file and attempt to output Markdown (compatible with Leanpub).

If you use the git editing method for Leanpub, you can have your Hemingway files in a directory called hemingway and use the example Makefile supplied here.

hem2md

To use, install the perl JSON module. The following converts an Hemingway file into markdown. Unfortunately it does not work very well with non-Latin character sets (which is annoying if you are writing books on... non-Latin character sets, like me). I may look at reimplementing this in Go which makes such things a lot easier.

hem2md 20240130-February.hemingway >> myoutput.md

At the top of the file, there will be an HTML comment to warn that the file is automatically generated. This can be useful if you are working on a document set and are using a Makefile to process lots of Hemingway files (like me). If you supply -n it will remove the comment as sometimes it can confuse other processors.

hem2jek

To use the Jekyll script, you need jekyll and ansi2txt from colorized-logs. Run the script in your jekyll site directory. For example, the following will parse the Hemingway file, take the title formatted with # and use that to create a jekyll post in _posts. If you supply -d you'll get a draft instead of a post.

hem2jek ~/Documents/Writing/Diet\ Blog/20240130-FebruaryRules.hemingway

Caveats:

  • This filter will use * for italics, not _. (Hemingway extracts use _).
  • We've only filtered scenarios we have seen coming from Hemingway files. There may be scenarios not covered

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.