Open mpathy opened 8 years ago
+1
Would be also okay if its just semiautomagically.. Like, moving some CSS to some folder and editing some config file.. Wouldnt even need UI for that..
X:\Users\"myaccount"\AppData\Roaming\Brackets\extensions\user\gruehle.markdown-preview\themes
settings.html
in X:\Users\"myaccount"\AppData\Roaming\Brackets\extensions\user\gruehle.markdown-preview\templates
as in the following adding the Markdown7
and the Screen
themes
...
<div class="md-settings-row">
<span class="md-settings-label">Theme</span>
<select id="markdown-preview-theme">
<option value="clean">Light</option>
<option value="dark">Dark</option>
<option value="serif">Classic</option>
<option value="markdown7">Markdown7</option> <!-- ADDED -->
<option value="screen">Screen</option> <!-- ADDED -->
</select>
</div>
[F5]
)Though, 2 imperfections here:
Different "straight forward" solutions should work, depending on how/where you want to save or share those files... you may edit the preview.html
in the plugin template directory and the main.js
in the plugin root to match your needs... 😄
E.g.:
I modified the main.js
file to re-define themeUrl
(the baseUrl
statement already exists...) so the html file now refer to the markdown preview plugin themes files correctly (html is not sharable but it can be saved locally on my system and the theme works).
// Make <base> tag for relative URLS
var baseUrl = window.location.protocol + "//" + FileUtils.getDirectoryPath(doc.file.fullPath);
// NEW LINE:
var themeUrl = window.location.protocol + "//" + require.toUrl("./themes/" + _prefs.get("theme") + ".css");
// Assemble the HTML source
var htmlSource = _.template(previewHTML)({
baseUrl : baseUrl,
themeUrl : themeUrl, // MODIFIED
scrollTop : scrollPos,
bodyText : bodyText
});
It would be great if there would be the possibility to add own themes to the themes folder, and that the plugin just scans the folder and list all entries in the directories.
Also it would be nice to have the possibility to save the preview HTML - not everyone has their own build infrastructure for markdown files, or uses it in Github or some other site - and just want to generate a HTML file easily.