shibacomputer / txt

A simple, private writing app.
https://newdesigncongress.org
GNU General Public License v3.0
94 stars 7 forks source link

CriticMarkup Syntax highlighting support within the Txt editor #41

Open shibacomputer opened 4 years ago

shibacomputer commented 4 years ago

Txt uses CriticMarkup to track changes within a document. This is because each document created or edited with Txt must be inter-operable in other applications with minimal data loss. Embedding comments, changes, substitutions and other simple document edits in a plaintext document fits the scope of this philosophy.

As per the spec, CriticMarkup uses a simple set of actions for editing and annotating plain text: addition {++ ... ++}, deletion {-- ... --}, substitution {~~ ... ~> ... ~~}, comment {>> <<}, and highlight {== ... ==}{>> ... <<}

Our text editor component for Txt is currently Codemirror (although this isn't a hard requirement), and the app's basic Markdown highlighting support needs to be extended to detect instances of key CriticMarkup syntax, and apply the colours as found in the defined in Txt's definitions.css file. For convenience, the CSS variables are:

var(--comment)
var(--deletion)
var(--addition)
var(--substitute)
var(--highlight-background)
var(--highlight-foreground)