Giter Club home page Giter Club logo

merlot's Introduction

Merlot ๐Ÿท

Build Status

Merlot is a web-based writing app that supports Markdown. It replaces iA Writer for me as my primary blogging and writing app, while filling in some other use cases I had in mind like sharing drafts. In fact, this very README was written in Merlot!

Screenshot of Merlot on desktop and mobile

Merlot is written in pure Ink and depends on Torus for rendering. The September compiler is used to compile UI code written in Ink to a JavaScript bundle for the browser. It uses a Markdown library for Ink that I wrote specifically for this app, which you can find in lib/. I also shared my process of building Merlot on Twitter.

Some design and workflow inspirations for Merlot include Notea, Notion, and iA Writer.

Features

I always try to discover a personal workflow first, before building a tool for myself around it. That means I can design a tool around my workflows rather than the other way around, making sure that the tool works with the grain of my mental models. Before I wrote Merlot, I was a heavy user of iA Writer, a Mac app for writing in Markdown. It was clean and fast and did what it did very well, but missing some features -- the features that Merlot adds.

Features like:

  • Extensive keyboard shortcuts. I designed Merlot so I could perform 99% of day-to-day operations in the editor without my hands leaving the keyboard.
  • Sharing drafts right from the editor. I often want to write short documents or notes to share with a few people quickly, and Google Docs and Notion feel too heavy. iA Writer itself has no sharing functionality, so I integrated the ability to share a preview of a file right into Merlot through the "Share" button, which opens a public preview.
  • UX on non-Apple platforms. iA Writer has apps available on Android and Windows, but the experiences there are subpar. I wanted a good quality writing experience everywhere, which meant building for the web.
  • Explicit HTML syntax. One of my main qualms with writing Markdown content for my blogs is that my current engine (Hugo) doesn't give me a way to explicitly designate certain sections as safe HTML content -- the engine tries to infer this, which is often unsafe. Merlot's flavor of Markdown provides a !html syntax to explicitly denote HTML snippets to embed into my Markdown files.
  • Storage that I can own. As with all of my other tools, Merlot saves its data in an open, compatible format (simple Markdown files) in a storage location I control on my own servers.

Beyond these key features, Merlot also supports live preview as you're writing, as well as a nice dark mode.

Markdown syntax

Merlot's Markdown implementation attempts to be broadly compatible with GitHub and CommonMark specifications, and is designed for longform writing use cases, because that's what I needed it for (a writing app and a blogging engine).

The Markdown parser and compiler interoperate, but are modular against a well-tested specification for a Markdown AST representation based on HTML. The parser can be used independently of the compiler to render HTML through another renderer (for example, a reactive virtual DOM implementation like Torus), as well as fed into the compiler to generate HTML text.

Merlot's Markdown parser adds a few exceptions to the common Markdown syntax that adds features I personally find useful:

  • Explicit inline HTML declaration with !html. Every line following and including the !html line is parsed as inline HTML, until an empty line.
  • Class syntax for inline images. This is an upcoming feature.

Architecture

The Merlot project has three components: the Markdown engine, the editor, and the server.

Merlot's Markdown engine is custom to this project. It tries to be reasonably compatible with GitHub flavored Markdown and CommonMark, but takes liberties where I thought I preferred a deviation from the norm (like inline HTML).

The Markdown engine is written in pure Ink, and reused across both the native backend and the web editor. In the server, it's used to render a public preview (the "Share" link) on the server side. In the client, it's used to generate previews for the document being edited without a round-trip to the server.

The editor is built on top of a simple text area, and the rest of the app is written in Ink on top of the Torus UI library. The server is kept simple, with a minimal REST API to save and retrieve documents as well as generate public previews.

Deployment modes

Merlot can be built in two different modes: a "dynamic" mode, where data is saved to a database on the server, and a "static" mode, where the app becomes a static site and saves everything to the browser's local storage. Both share much of the codebase, and which one is built depends on build-time imported configuration variables.

I personally use the dynamically deployed version for personal use, which also gives me the "Share" preview feature that isn't available on the static builds, and lets me carry data across devices. There is also a public static version deployed on Vercel.

Development

Merlot uses a Makefile for development tasks. To develop Merlot, you'll need to install Ink and the September compiler. inkfmt is optional, and used for code formatting.

  • make run starts the web server in the same way as the production environment. This is not necessary for the static deployment mode.
  • make build builds the frontend JavaScript bundles for all modes.
  • make watch runs make build every time a relevant Ink source file changes.
  • make check or make t runs Merlot's Markdown library test suite, which lives in test/.
  • make fmt runs the inkfmt code formatter over all Ink source code in the project.

Deploy Merlot

To deploy Merlot, the steps required depend on the kind of build you want to use (see "Deployment modes" above).

You can find the static build of Merlot available at merlot.vercel.app. To deploy this version, simply deploy the static/ directory as a static site.

There is not a public deployment of the dynamic build. To deploy this version, you'll need Ink installed. After that, run ink src/main.ink from the root directory of the project to run the dynamic deployment. The app will be available on port 7650 by default.

Roadmap

There are a few features that I'd like to include in Merlot and the Markdown library that aren't there yet.

  • Support for bulleted lists starting with * instead of -
  • Support for multiple paragraphs and rich blocks inside list items
  • Syntax highlighting on code blocks with language tags
  • Class syntax for inline images

merlot's People

Contributors

thesephist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

merlot's Issues

CommonMark compliance

This is mostly subjective, but being compliant with the CommonMark spec seems like a good way to ensure that Merlot behaves in a way people expect, and Markdown written in Merlot can interoperate in other CommonMark-compliant tools.

80vh behaves strangely in Firefox

I'm a big fan of markdown editors. Don't know if you've seen either https://nota.md/ or https://inns.studio/mak, but they both put a unique twist on markdown writing apps.

There are some funny issues with Firefox and the padding-bottom: 80vh. On Firefox 78 I get

image

And on Firefox 88 (latest macOS) the editor is visible, but it doesn't have the intended spacing at the bottom. Works well on Safari and Chrome.

"Say something..." a bit misleading when starting from scratch

Enjoyed testing out the app, but when I first opened it up, and tried typing on the "Say something..." panel, and nothing worked, I was confused. Eventually I realized I needed to hit + to create a file. Would be good to have it prompt to create a new file, or create an untitled file by default if there aren't any yet if the user starts typing.

Add a print stylesheet

Right now, when you try to print from the full preview view, you just see the first page of the preview, along with all the app UI.

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.