A port of write good, 3 shell scripts to improve your writing, or "My Ph.D. advisor rewrote himself in bash.", and How I reverse-engineered the Hemingway Editor - a popular writing app - and built my own from a beach in Thailand for Gtk TextView.
Currently, we have:
en_US
meson
ninja-build
valac
cmake
libgtk-3-dev
vala
meson
ninja-build
cmake
gtk3-devel
If your build system is meson, we recommend using the wrap depenency system
[wrap-git]
directory=libwritegood
url=https://github.com/ThiefMD/libwritegood-vala.git
revision=master
Place the libwritegood.wrap
in subprojects directory in your project.
In your meson.build, add:
writegood_dep = dependency('writegood-0.1', fallback : [ 'writegood', 'libwritegood_dep' ])
Then add writegood_dep to your dependencies.
This example is with Gtk.SourceView, but a Gtk.TextView will also work.
var manager = Gtk.SourceLanguageManager.get_default ();
var language = manager.guess_language (null, "text/markdown");
var view = new Gtk.SourceView ();
buffer = new Gtk.SourceBuffer.with_language (language);
buffer.highlight_syntax = true;
view.set_buffer (buffer);
view.set_wrap_mode (Gtk.WrapMode.WORD);
//
// Enable write-good
//
checker = new WriteGood.Checker ();
checker.set_language ("en_US");
checker.attach (view);
//
// Quick check only scans around the last check cursor position, and
// and the current cursor position
//
buffer.changed.connect (() => {
checker.quick_check ();
});
//
// Recheck all will scan the entire document
//
buffer.paste_done.connect ((clipboard) => {
checker.recheck_all ();
});
After running meson build
inside of the build directory run meson configure -Denable_examples=true
. This will build the hello-writegood app that can be used for testing.