TaskPaper HTML export, theme auto-conversion, and Ruby library


#1

I’ve written a Ruby library/command-line-interface for TaskPaper files. You can:

  • Create, open, inspect, edit, and save TaskPaper files
  • Export TaskPaper files as HTML and CSS
  • Automatically (if you have Less installed) convert your actual TaskPaper theme to CSS
  • Export as JSON

It’s free and open source. You can get the code on github. There are screenshots on that page of a sample theme (my own) and the resulting HTML output:

I hope you’ll find it useful. If you want to report bugs or submit feature requests, please do so at the repository’s issue tracker. I’ll accept praise and encouragement via any avenue, however… :grin:

If you want to get in touch otherwise, Twitter is best.

(Addendum: I see that Jesse has just released a 3.1 Preview 185 of TaskPaper, with support for depth attributes in themes. I’ve updated the Ruby library accordingly.)


How to convert Taskpaper projects/task text into a bulleted list?
Export to HTML/RTF (for use with Google Doc)
#2

This is all great, but the automatic style conversion is most unexpected and cool!

Going forward I’ve got lots of code that could help a project like this, but I’m still not sure what the best way to distribute it is for both me and everyone else. For example right now in the scripting API there’s the ItemSeriailizer class. It support read/write of three formats:

  1. BML - HTML subset.
  2. OPML - Outline processing markup.
  3. TEXT - This is how TaskPaper files are encoded.

I call TaskPaper’s underlying outline model “Birch”. BML is intended to be Birch’s native serialization. It’s not human readable like the TEXT serialization, but it is easier to parse and manipulate (since it’s HTML subset), preserves unique ids for each item, and displays in any web browser.

Right now this stuff is only accessible through TaskPaper’s scripting API which makes it fairly locked in and not suitable for a script like yours. But going forward it’s all written in Javascript and so it can run just about anywhere. Along with TaskPaper’s query language and all the rest of the API.

I’d like to release all this as an npm package so TaskPaper can spread more easily and in a standard form. The difficulty is that I’d like to somehow retain my right/avoid clones/keep eating! Any thoughts on this:

  • Make it fully open source. Mostly likely to spread TaskPaper, but then anyone can pretty easily clone TaskPaper.

  • Make it shared source. So source code is there, but to use it you must also have a TaskPaper license. I wouldn’t be able to enforce this (or really care too) at individual level, but it should keep clones from replacing TaskPaper.

Or some other setup?

Anyway would love to hear what anyone things. @mattgemmell if such as API were available do you think you would have used for this project. Or would you rather have just coded things up yourself for maximum freedom and flexibility?


#3

(Aside: I’ve just hugely improved TaskPaperRuby’s HTML/CSS generation, supporting pretty much all of the current theme stuff, wherever possible.)

I wanted to create something entirely standalone, so I’d always have gone the route I did, but more integration is always a good thing. My feeling is that your value is in the app and the community around it. Shared source isn’t going to work, and frankly the TaskPaper format/workflow’s primary attraction is that it’s simple and open. Anyone can already clone TaskPaper; the value is in the polish of the existing app, and the things people have made for it.

I’d release your ancillary integration/API stuff as fully open source. Being the best and most attractive option always trumps trying to be the only option.


#4

I think this is true if you think of TaskPaper the file format. It’s easy to write a highlighter or parser. But I don’t think it’s true if you think of TaskPaper’s runtime model:

  • Outline model
  • With query parser and evaluator.
  • Mapped to a text buffer supporting focusing, folding, and filtering.

At least it’s taken me 5 years to really get the design right. And if I release it open source it becomes easy for anyone to reproduce those core features and charge little or nothing.

It may very well be that open source would be the best result for everyone. But no strings attached is a pretty scary proposition from my perspective.

Anyway I’ll keep thinking. And listening to other ideas. Time to go back to fixing bugs for the moment :smile:


#5

To clarify, I wasn’t suggesting open-sourcing the app itself; just potentially the stuff to integrate with its format, query, etc. I think there’d be value that would only increase interest in TP itself. But as you say, it’s easy enough for people to work with just the file format in their own way.


#6

Just an aside: I ran a sample TaskPaper file through my HTML converter while using the Atom One Dark theme someone else posted. Makes a pretty good job of it.

First screenshot is TaskPaper, and the second is Safari.


#7

Can you interact with the browser GUI or is that view only?


#8

View only. No interest in building a web app here, but feel free. :smile:


#9

A further update to TaskPaperRuby today: it now has a plugin system, to modify the HTML output. Three sample plugins are included:

  • Basic Markdown (italic-emphasis, bold-emphasis, and backticks code sequences)
  • Emoticons: a few essential smilies are replaced with corresponding emoji
  • Tag icons: some common tags and values are replaced with emoji icons

You can customise and/or enable/disable plugins as you wish. I’ve updated the README too. Below are before/after screenshots of a sample TaskPaper file, and its exported HTML version.

TaskPaper:

and Safari:


#10

Just a note that TaskPaperRuby has been updated to also support JSON export, as well as TaskPaper, and HTML/CSS.

Given an existing TaskPaper document, JSON output can be generated as follows:

puts TaskPaperDocument.open("~/Desktop/sample.taskpaper").to_json

You can of course also create entirely new TaskPaper documents with TaskPaperRuby, and export them to whichever format you like. You can validate JSON output here.


#11

Matt, it the Markdown plugin ready? Does that mean that one can just export the taskpaper file into a md file? How?