From bc328642e77ca6b73b861d2d9de269864c234d7e Mon Sep 17 00:00:00 2001 From: Mathieu PATUREL Date: Sun, 5 Feb 2017 09:27:32 +1100 Subject: [PATCH] [docs] remove doc from readme --- README.md | 87 +----------------- .../imgs}/syntax-specific-settings.png | Bin docs/index.md | 38 +++++++- functions.py | 2 +- 4 files changed, 39 insertions(+), 88 deletions(-) rename {screenshoots => docs/imgs}/syntax-specific-settings.png (100%) diff --git a/README.md b/README.md index 0d5cb72..fcbd72c 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,7 @@ This is a sublime text **3** plugin that allows you to preview your markdown ins ### Dependencies -**None! There is no dependency! It uses [markdown2](https://github.com/trentm/python-markdown2) but -**it's a one file plugin, so it's included in the package. +**None! There is no dependency!** It uses [markdown2](https://github.com/trentm/python-markdown2) but it's a one file plugin, so it's included in the package. ## Installation @@ -18,7 +17,7 @@ MarkdownLivePreview is available on the default channel of 4. hit enter to have MarkdownLivePreview working on your computer. Cool right? You can -[thank package control](https://packagecontrol.io/say_thanks) for this. +[thank package control](https://packagecontrol.io/say_thanks) for this. :wink: ### Usage @@ -33,92 +32,12 @@ Once you're done, close whichever file and it'll close the entire window. *Notice that it will close the entire window if you close __whichever__ file. It means that if you* *open a random file in this window, and then close it, it'll close the entire window still* -### Settings - -To edit MarkdownLivePreview's settings, you just need to look in the command palette -`Preferences: MarkdownLivePreview Settings`, or from the menus: -*Preferences → Package Settings → MarkdownLivePreview → Settings* - -Do not edit the left file (by default, you cannot), but edit the right file. This last file will -override the default one (on the left), and will be saved in your `User` folder, which makes it easy -to back up. - -- `markdown_live_preview_on_open`: if set to `true`, as soon as you open a markdown file, the -preview window will popup (thanks to[@ooing](https://github.com/ooing) for its -[suggestion](https://github.com/math2001/MarkdownLivePreview/issues/7#issue-199464852)). Default to -`false` -- `load_from_internet_when_starts`: every images that starts with any of the string specified in -this list will be loaded from internet. Default to `["http://", "https://"]` -- `header_action`: If you're writing a blog with some markdown and a static website generator, you -probably have a YAML header. By default, this header will be displayed in a `pre` block. If you want -to hide it, then just set the value to `remove` -- `keep_open_when_opening_preview`: Each time the preview window is opened, the original markdown -view is closed. If you want to keep it opened, just set this setting to `true` - -### Syntax Specific Settings - -This in an other "type" of setting. :laughing: If you have a look at the syntax of the preview file -(not the markdown one, really the preview), you'll see that the syntax is -`MarkdownLivePreviewSyntax`. This mean that you can specify specific settings for this specific -syntax (such as `word_wrap: true`, `rulers: []`, etc). - -To do so, you can - -1. focus the *preview* (ctrl+2 to focus the second group, so, by default, the -preview's group) -2. search up in the command palette `Preferences: Settings Syntax Specific`. It's in the *right* -file that you can add the settings you want (not the left one). - -Note: MarkdownLivePreview will actualy look in this file for settings that aren't supported by -default. Here they are: - -- `show_tabs` -- `show_minimap` -- `show_status_bar` -- `show_sidebar` -- `show_menus` - -They talk for themself, don't they? All of them takes a boolean (`true` or `false`). Note that those -settings are *window* specific, not just view specific (that's why they aren't supported). It means -that they'll affect the entire window, and every view in it. - -Here is an example of syntax specific settings for MarkdownLivePreviewSyntax: - -```json -{ - "show_menus": false, - "show_tabs": false, - "show_minimap": false, - "gutter": false, - "rulers": [], - "word_wrap": true -} -``` - -And here's what you'll get: - -![MarkdownLivePreview Screenshoot](screenshoots/syntax-specific-settings.png) - -*Note: to close a file, you can do ctrl+w (on Mac OS, it's cmd+w)* - -### Clear the cache - -MarkdownLivePreview caches every images it loads from internet (otherwise, you'd never see your -images, or you'd need to have a *really* fast internet connection :smile:). So, if for some reason -you want to clear the cache (a simple file), you can do so from the command palette by running ` +For further infos, please [read the docs](https://math2001.github.io/MarkdownLivePreview/)! ### Demo ![demo](demo.gif) -### Custom css - -It is possible to set your own css. But, be carefull, you have to respect -[those rules][st-css-rules]. Just go to -`Preferences → Package Settings → MarkdownLivePreview → Style - CSS`. It will open a css file, here: -`$packages/User/MarkdownLivePreview.css`. Just save it and it will automatically use it instead of -the default one. - ### Somethings wrong!! If you find that something's wrong with this package, you can let me know by raising an issue on the diff --git a/screenshoots/syntax-specific-settings.png b/docs/imgs/syntax-specific-settings.png similarity index 100% rename from screenshoots/syntax-specific-settings.png rename to docs/imgs/syntax-specific-settings.png diff --git a/docs/index.md b/docs/index.md index fa2c576..ddcd7a2 100644 --- a/docs/index.md +++ b/docs/index.md @@ -61,6 +61,28 @@ As told in the introduction, MarkdownLivePreview is very easy to use: That's it. That's all you need to do to preview your markdown! +### Settings + +To edit MarkdownLivePreview's settings, you just need to search in the command palette +`Preferences: MarkdownLivePreview Settings`, or from the menus: +*Preferences → Package Settings → MarkdownLivePreview → Settings* + +Do not edit the left file (by default, you cannot), but the right one. This right file will +override the default one (on the left), and will be saved in your `User` folder, which makes it easy +to back up. + +- `markdown_live_preview_on_open`: if set to `true`, as soon as you open a markdown file, the +preview window will popup (thanks to[@ooing][] for its [suggestion][@ooing suggestion]). Default to +`false` +- `load_from_internet_when_starts`: every images that starts with any of the string specified in +this list will be loaded from internet. Default to `["http://", "https://"]` +- `header_action`: If you're writing a blog with some markdown and a static website generator, you +probably have a YAML header. By default, this header will be displayed in a `pre` block. If you want +to hide it, then just change the value to `remove`. Thanks to [@tanhanjay][] for +[letting me know][front-matter-issue]! +- `keep_open_when_opening_preview`: Each time the preview window is opened, the original markdown +view is closed. If you want to keep it opened, just set this setting to `true` + ### Custom CSS If you want to, you can add custom `CSS` to the MarkdownLivePreview's default stylesheet. @@ -121,7 +143,7 @@ As you probably guessed those settings takes a bool for value (`true` or `false` ### Recommendation -Here's what I'd recommend (and use): +Here's what I'd recommend for your MarkdownLivePreviewSyntax's settings (and what I use): ```json { @@ -134,9 +156,13 @@ Here's what I'd recommend (and use): } ``` +And here's what you'll get (With the awesome [Boxy Theme][] and its [Monokai Color Scheme][]): + +![MarkdownLivePreview Screenshoot](imgs/syntax-specific-settings.png) + !!! tip - On Windows at least, you can press alt to focus (so show) the menu, even if they're - originally hidden + On Windows at least, you can press alt to focus (so show) the menus, even if they're + originally hidden. That's it! I hope you'll enjoy using this package! If it's the case, please let your friends know about it, and even myself by sending me a [tweet][] or staring the repo! @@ -150,3 +176,9 @@ frameborder="0" scrolling="0" style="width: 120px; height: 30px; vertical-align: [install-pck-con]: https://packagecontrol.io/installation [tweet]: https://twitter.com/_math2001 [GitHub repo]: https://github.com/math2001/MarkdownLivePreview/issues +[@ooing]: https://github.com/ooing +[@ooing suggestion]: https://github.com/math2001/MarkdownLivePreview/issues/7#issue-199464852 +[@tanhanjay]: https://github.com/tanhanjay +[front-matter-issue]: https://github.com/math2001/MarkdownLivePreview/issues/17 +[Boxy Theme]: https://packagecontrol.io/packages/Boxy%20Theme +[Monokai Color Scheme]: https://github.com/ihodev/sublime-boxy#boxy-monokai--predawn diff --git a/functions.py b/functions.py index 8ef73ab..dff7281 100644 --- a/functions.py +++ b/functions.py @@ -47,7 +47,7 @@ def replace_img_src_base64(html, basepath): elif img['src'].startswith(tuple(load_from_internet_starters)): image = ImageManager.get(img['src']) or loading else: # this is a local image - image = to_base64(os.path.join(basepath, src)) + image = to_base64(os.path.join(basepath, img['src'])) img['src'] = image