Skip to content

Releases

Plugin SDK v0.1.3

Choose a tag to compare

@SugarFatFree SugarFatFree released this 11 Sep 06:54

Added

  • as = "web" — a plugin can draw its own HTML page. ui.webview had been
    declared, described to the reader, listed here in twelve languages and given a
    proxy of its own, and there was no way for a plugin to open a page. There is
    now: a pane whose text is an HTML document, drawn by the operating system's
    web engine rather than a browser packaged with the editor, and created only
    when a plugin asks so a reader who never opens one never pays for an engine.
    Where the page goes is written to the plugin log. Windows and macOS have an
    engine the editor can use; a Linux box without one gets a line saying so,
    naming the plugin, rather than an empty pane.

    Declaring ui.webview now carries ui.sidebar as well as network.request:
    a page arrives as a pane, and taking room beside the document is not something
    to get for free alongside the engine.

  • What a panel is asked on a second round. A command run from a panel can
    now be run again, with the reader asking for its answer to be changed rather
    than describing the whole thing afresh. The editor says so in fields the
    script already knows: ctx.selection is the script's own last answer,
    because a follow-up is about the draft in front of the reader rather than
    the document, and ctx.answer is what was asked for this time.

    A command that reads the selection as "the part to work on" needs no change.
    One that ignores ctx.selection will rewrite the whole document every
    round, which is not what was asked. The box is only offered when the command
    asked something to begin with, since that is where a follow-up arrives.

  • sdk.ui — a plugin can draw its own interface. It returns a tree of
    nodes (text, input, chips, button, row, column, spacer) and the
    editor renders them as its own widgets; pressing a button calls
    on_event(ctx, id, values) with every input in the tree by id, so a plugin
    never has to remember the form it drew a step ago.

    Not HTML, and deliberately: these are the editor's own widgets, so they cost
    nothing at startup, follow the reader's theme without the plugin knowing what
    the theme is, and cannot draw outside the container they were given. A
    WebView escape hatch is planned separately for what this cannot express.

    A misspelled node refuses the whole tree with an error rather than quietly
    drawing nothing, and so does a tree deeper than 12 or larger than 500 nodes —
    half a form is worse than none.

  • Three more nodes: select (a dropdown, for when there are too many options
    for chips), checkbox (its value arrives as "true" or "false", because
    everything a plugin is told is a string), and markdown — drawn by the
    editor's own renderer, so an answer that is a document looks like one
    instead of showing its own ## and **.

  • An image node. source is a data: URI, a path inside your own plugin
    directory, or an http(s) URL — and that last one is fetched by the
    editor
    , so it follows the reader's system proxy and lands in your plugin's
    log with the host, status, size and time. You may reach the network; the
    reader may find out where you went. A permission nobody can check up on
    afterwards is a promise rather than a permission.

  • ui.webview joins the permission list, and carries network.request with
    it
    — the reader is shown both, because a permission list that understates
    what it grants is worse than none. The web view itself lands in a later
    release; the permission and the logging are here first.

Nothing here changes how a plugin behaves. One of them changes what the
documentation tells you to do, which for someone starting a plugin is the
same thing.

  • The safety rules now state the limits an installed ZIP has to fit: 64 MB for
    the archive, 10000 entries, 256 MB unpacked. They were added to the editor
    today (a ZIP was free to claim it unpacked to gigabytes, and to mean it), and
    an author who packages three platforms' executables should hear the number
    from here rather than from a failed install.

  • The icon names a panel may use are in the schema. It asked only for a
    non-empty string, so the forty names the editor can draw were something to
    guess at — and a name it does not know draws a generic plugin square with
    nothing said, which reads as the editor ignoring your icon rather than as a
    typo. An editor writing your manifest now completes them and refuses the
    rest.

  • Where to look when a plugin installs and does not appear. The editor
    lists a plugin whose manifest it could not read below the ones that loaded,
    with the key it could not read and what it expected there, and a delete
    button on that row. "Trying a plugin before you ship it" only covered trying
    one before shipping; it now covers the case where it is installed and
    invisible, with the three reasons that account for most of it.

Fixed

  • The API module still listed seven kinds of interface node; there are
    eleven.
    select, checkbox, markdown and image were added to the
    editor and written into the README's table, and the one-line list inside both
    API modules stayed where it was. That list is what an author reads in an
    editor's hover, which is where "what can I put in a tree?" is actually asked
    — and a tree is refused whole over one unknown node, so not knowing a kind
    exists costs a whole interface rather than one node.

    scripts/check.py now holds the two modules to the README's table, and the
    editor's own test suite holds that table to the nodes it draws. Between them
    a kind cannot be added in one place and missed in the other two.

  • Five rows of the permissions table promised things the editor has never
    built.
    "add a toolbar button", "add a status-bar item", "add commands to
    the palette", the clipboard and the workspace: seven permissions in all, and
    behind each of them nothing. There is no toolbar or status bar a plugin can
    add to, nothing registers a plugin's commands in the palette, and neither
    script runtime mentions a clipboard or a workspace anywhere. An author who
    read a row, declared the permission, wrote the manifest entry and saw nothing
    happen had lost an evening to a sentence.

    They are marked † now, in all twelve languages, with a note under the table
    saying what the dagger means: the permission is real and the reader is shown
    it, and there is nothing behind it yet. The rows stay, because they are part
    of the manifest and will be honoured when the capability arrives. The
    editor's own test suite decides which rows carry the dagger — the day one of
    these is implemented, the dagger has to come out or that test fails.

  • The examples said they showed all of it, and showed seven of twelve.
    "Every capability the editor offers is used once" opened both scripts, and
    the five they leave out include pane — the grid the editor lays results out
    in, the one that takes a slot, a way of drawing and an Apply button, and the
    one the shipped AI plugin lives in. An example is the first thing an author
    copies, so a claim on top of it is read as a map of the API. They now say
    which seven, point at the actions table for the rest, and name pane as the
    one to read next; scripts/check.py counts both numbers and fails when
    either drifts.

  • Nothing compared the eleven translated actions tables with the English
    one.
    An eleventh action added to the English table would have left the
    other eleven at ten, and an author reading in their own language would never
    have learned it existed. Compared by the action name rather than the whole
    cell, since the metavariables inside it — <node> and the ellipses — are
    English words and are translated on purpose.

  • nothing() had lost its comment to ui(). When ui was added between
    replace and nothing, the one-line description stayed where it was — so
    Do nothing. ended up on top of the interface-drawing documentation, and the
    function that does nothing said nothing at all. In both languages, because
    they were edited together. Nobody reads this module top to bottom; it is read
    one function at a time in an editor's hover, where a comment one function out
    describes the wrong thing with the same authority as a right one.

    scripts/check.py now requires every exported name to have a doc comment
    immediately above it, in both languages, so the next insertion cannot take
    one with it.

  • The English README said there is no require, five paragraphs after
    explaining how to use it.
    The sandbox list — "no os, no package, no
    require, no dofile, no loadfile" — was written before a plugin could be
    more than one file. Lua's own require is indeed removed; the editor then
    installs one that cannot leave the plugin's own directory, which is what
    loads lib/marktext-plus.lua. So the document told an author their require
    would fail while shipping a library file that needs it. All eleven
    translations had been corrected and the English had not, which is the
    opposite of the usual direction.

  • ctx.view was documented in seven languages and missing from five.
    A script is told whether the reader is in source, preview or split;
    English, German, Japanese, Korean and Chinese never said so. The same four
    translations once lost the side panel.

    Both were found by comparing the backticked identifiers across the twelve —
    the one part of a document in eleven languages that does not change with the
    language. The editor's sdk_schema_agrees_test now holds all twelve to the
    same set of 108, with no exceptions.

  • All twelve READMEs still described the rule the editor stopped following.
    A lone pane used to sit beside the document whatever slot it claimed — "one
    pane is one pane whichever slot it claimed" — and since 2026-09-07 the name
    decides: only bottom puts it under the document, any other slot beside it.
    The edi...

Read more

Plugin SDK v0.1.2

Choose a tag to compare

@SugarFatFree SugarFatFree released this 04 Sep 22:48

The first release rather than a pre-release.

Still 0.x. The manifest and the protocol are settling but not settled, and
a deliberate breaking change remains possible while that is true — it will be
in the changelog with what to do about it. What the editor will not take away
without warning is pinned by a test in its own source: every permission name,
every runtime value, every action a script can return, every field of ctx.

Added

  • apply on a pane action puts an Apply button on it, which writes what
    the pane holds into the document; replaces says what that replaces,
    and an empty one means the whole document. What a model returns is worth
    reading before it lands in what the reader was writing, so a rewrite is
    shown first and written when they say so — through the editor's history, so
    one press of undo takes it back. Needs document.write, which the editor
    checks at the button rather than trusting the flag.
  • description in the manifest: one line saying what the plugin does, for
    the plugin list. Like every other string a plugin shows, it may be a key
    into its own locales.

Documented

  • The panes are a grid of at most four cells, and the split view's own two
    halves are two of them
    . With three cells the plugin chooses which half is
    divided, and the reader can move it afterwards.
  • A pane belongs to the tab it was opened in.

Three complete example plugins to copy — Lua, JavaScript and a compiled one —
and documentation in eleven languages.

v0.1.0

Choose a tag to compare

@SugarFatFree SugarFatFree released this 02 Sep 03:22

Initial MarkText Plus plugin SDK and JSON-RPC protocol.