MacDownApp / macdown

Open source Markdown editor for macOS.
https://macdown.uranusjr.com/
9.45k stars 1.09k forks source link

New theme and style format #229

Open uranusjr opened 9 years ago

uranusjr commented 9 years ago

The current theme and style format is not very extendable. May need a better (bundled) format. This would be a good time to correct some it-was-a-good-idea-at-the-time mistakes.

Todo:

uranusjr commented 9 years ago

Style bundle format:

<style name>.macdownhtmlresource
    info.json
    <free form>

info.json:

{
  "version": 1,   // Incremental if format updates. Positive integer.
  "name": "Foobar",  // This is the name shown in the preferences.
  "stylesheets": [
    {
      "type": "text/css",     // Optional; this is the default.
      "path": "style.css"     // Relative to info.json
    }
  ],
  "scripts": []    // Similar to stylesheets. Defaults to "text/javascript".
}
uranusjr commented 9 years ago

The current strategy: Do not update formats in the near-future (maybe wait for one minor release, until 0.6), but automatically delete things from Application Support if they are identical to the bundled version. Custom things would stay intact; if names clash, suffix the user’s version with a number (or something).

And in 0.6 we should…

  1. Load built-in things from the app bundle.
  2. Ignore things from user’s lib if their names clashes with built-in ones. We can put up a release notice that these have been deprecated, and will no longer work in 0.6.
  3. Still allow both the old and new versions of plugins, to maintain maximum compatibility.

As a side note, I should ask if we can merge macdown-flatland-theme sometime after this is done.

uranusjr commented 9 years ago

Maybe it would be better to just let the bundled version take precedence. We can put up a backward-incompatibility notice, specifying that the assets in user-space will be shadowed by the bundled one since , and tell the user to rename their own modifications. Identical files still can be removed automatically (at least in the first versions, before they are converted to the new format), but that would become optional since they are shadowed anyway.

uranusjr commented 9 years ago

Editor theme bundle format:

<style name>.macdowneditortheme
    info.json
    <free form>

info.json:

{
  "version": 1,
  "name": "Whatever",
  "theme": "relative/to/info.json"
}