Markdown Viewer / Browser Extension
|
|
2 years ago | |
|---|---|---|
| background | 2 years ago | |
| build | 2 years ago | |
| content | 2 years ago | |
| icons | 2 years ago | |
| options | 2 years ago | |
| popup | 2 years ago | |
| .editorconfig | 9 years ago | |
| .gitignore | 2 years ago | |
| CHANGELOG.md | 2 years ago | |
| LICENSE | 7 years ago | |
| README.md | 2 years ago | |
| manifest.chrome.json | 2 years ago | |
| manifest.firefox.json | 4 years ago |
Install: Chrome / Firefox / Edge / Opera / Brave / Chromium / Vivaldi
chrome://extensionsDetails buttonAllow access to file URLs switch is turned onMarkdown Viewer can be used with any markdown parser/compiler. Currently the following compilers are supported: marked, remark, showdown, markdown-it, remarkable, commonmark, and officially it ships with Marked and Remark:
| Option | Default | Description
| :- | :-: | :-
| breaks | false | Enable GFM line breaks. This option requires the gfm option to be true.
| gfm | true | Enable GFM GitHub Flavored Markdown.
| pedantic | false | Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior.
| sanitize | false | Sanitize the output. Ignore any HTML that has been input.
| smartypants | false | Use "smart" typographic punctuation for things like quotes and dashes.
| Option | Default | Description
| :- | :-: | :-
| breaks | false | Enable GFM line breaks. This option requires the gfm option to be true.
| gfm | true | Enable GFM GitHub Flavored Markdown.
| sanitize | false | Sanitize the output. Ignore any HTML that has been input.
For any other supported compiler that you may want to use, follow the Manual Install steps.
| Option | Default | Description
| :- | :-: | :-
| autoreload | false | Auto reload on file change
| toc | false | Generate Table of Contents
| syntax | true | Syntax highlighted fenced code blocks
| mathjax | false | Render MathJax formulas
| mermaid | false | Render Mermaid diagrams
| emoji | false | Convert emoji :shortnames: into EmojiOne images
| scroll | true | Remember scroll position
When enabled the extension will make a GET request every second to markdown files hosted on:
file:/// URLs127.0.0.1 or IPv6 ::1Convert emoji :shortnames: into EmojiOne images:
:sparkles: will be converted to :sparkles: using EmojiOne images.✨ and ASCII emoji like :D are not supported.The following MathJax delimiters are supported:
\(math\) and $math$\[math\] and $$math$$The following rules apply to your markdown content when MathJax is enabled:
$ in text that is not part of a math formula should be escaped: \$\( and \), and brackets: \[ and \] is not supported. MathJax will convert anything between these delimiters to math formulas, unless they are wrapped in backticks: `\(` or fenced code blocks.Render Mermaid diagrams wrapped in mmd or mermaid fenced code blocks:
```mmd
sequenceDiagram
```
Remember scroll position:
scroll option remembers the current scroll position and scrolls back to it after page reload.scroll option will either scroll to the top of the document or to a certain header (anchor) if a hash URL fragment was present.Syntax highlighting for fenced code blocks:
```js
var hello = 'hi'
```
The full list of enabled languages and their names can be found here.
Generates Table of Contents (ToC) based on the headers found in the markdown document.
All themes support the following width options:
auto - automatically adjust the content width based on the screen sizefull - 100% screen widthwide - fixed at 1400pxlarge - fixed at 1200pxmedium - fixed at 992pxsmall - fixed at 768pxtiny - fixed at 576pxThe auto option on the github and github-dark themes has a fixed width with a surrounding border identical to a rendered README.md file for a repository on github.com
Access to local file URLs can be enabled by using the Allow access to file URLs option for the extension.
Access to remote origins, however, have to be enabled explicitly.
Here is how you can enable the extension on the https://raw.githubusercontent.com origin:
The origin consists of a protocol and a domain part. The protocol can be either https, http, or a * to match both https and http.
In case you really want to you can enable the extension for all origins:
Alternatively you can use the Allow All button.
Take a look at the Path Matching Priority section below on how the Markdown content can be included for or excluded from rendering when access to all origins is enabled!
Click on the REMOVE button for the origin that you want to remove. This removes the permission itself so that the extension no longer has access to that origin.
The extension synchronizes your preferences across all of your devices using Google Sync. The list of your allowed origins is being synced too. However, the actual permissions that you grant using the Chrome's consent popup cannot be synced.
In case you have added a new origin on some of your devices you will have to explicitly allow it on your other devices. In this case an additional refresh label will be shown on each origin that needs to be refreshed. This label will be present only on those devices and origins that needs to be refreshed, meaning currently the extension does not have access to those origins. Expanding the origin will reveal an additional REFRESH button:
Markdown Viewer can only access explicitly allowed remote origins and the file origin, if enabled. However, not all content served on those origins will be a Markdown file.
When this option is enabled the extension will check for the existence of the text/markdown and text/x-markdown content-type header before trying to match the path:
If the header detection is disabled or a proper content-type header is missing, the extension will check if the URL is ending with a markdown file extension.
The default regular expression is: \.(?:markdown|mdown|mkdn|md|mkd|mdwn|mdtxt|mdtext|text)(?:#.*|\?.*)?$
It is a simple regular expression that matches URLs ending with:
\.(?:markdown|mdown|mkdn|md|mkd|mdwn|mdtxt|mdtext|text)(?:#.*|\?.*)?The
?:used in(?:match)stands for non-capturing group and it's there for performance reasons.
You can modify the path matching regular expression for each enabled origin individually. The settings are being updated as you type.
The enabled origins are matched from most to least specific:
https://raw.githubusercontent.com or http://raw.githubusercontent.com*://raw.githubusercontent.com*://*Only the first matching origin is picked and then its Path Matching RegExp is used to match the entire URL. If it fails then no other attempts are being made to match the URL.
It is recommended to explicitly allow only the origins that you want the extension to have access to.
*://website.com - specific origin with custom Path Matching RegExp:
\/some\/custom\/path\/to\/serve\/markdown\/$
*://* - match all origins using the default Path Matching RegExp:
\.(?:markdown|mdown|mkdn|md|mkd|mdwn|mdtxt|mdtext|text)(?:#.*|\?.*)?$
In case we want to match a custom path we have to add a more specific origin and set its Path Matching RegExp accordingly.
*://github.com - specific origin with invalid Path Matching RegExp:
something impossible to match !!!
*://* - match all origins using the default Path Matching RegExp:
\.(?:markdown|mdown|mkdn|md|mkd|mdwn|mdtxt|mdtext|text)(?:#.*|\?.*)?$
Some origins may serve rendered HTML content on URLs ending with markdown file extension:
GitHub:
In this case we want to exclude the github.com origin altogether and for that we have to add a more specific origin and set its Path Matching RegExp to something that's impossible to match.
*://bitbucket.org - specific origin with custom Path Matching RegExp:
.*\/raw\/.*\.(?:markdown|mdown|mkdn|md|mkd|mdwn|mdtxt|mdtext|text)(?:#.*|\?.*)?$
*://gitlab.com - specific origin with custom Path Matching RegExp:
.*\/raw\/.*\.(?:markdown|mdown|mkdn|md|mkd|mdwn|mdtxt|mdtext|text)(?:#.*|\?.*)?$
*://* - match all origins using the default Path Matching RegExp:
\.(?:markdown|mdown|mkdn|md|mkd|mdwn|mdtxt|mdtext|text)(?:#.*|\?.*)?$
Some origins may serve rendered HTML content on URLs ending with markdown file extension:
BitBucket:
GitLab:
In this case we want to match Markdown files only when their path contains the raw word, and for that we have to add a more specific origin and update its Path Matching RegExp accordingly.
A separate repository containing examples about the Markdown syntax and all features available in Markdown Viewer can be found on GitHub, GitLab and BitBucket:
Allow the appropriate remote origin and update its path matching regexp if needed:
raw.githubusercontent.com using the default Path Matching RegExp:
\.(?:markdown|mdown|mkdn|md|mkd|mdwn|mdtxt|mdtext|text)(?:#.*|\?.*)?$
bitbucket.org only paths containing the raw word and ending with the default Path Matching RegExp:
.*\/raw\/.*\.(?:markdown|mdown|mkdn|md|mkd|mdwn|mdtxt|mdtext|text)(?:#.*|\?.*)?$
gitlab.com only paths containing the raw word and ending with the default Path Matching RegExp:
.*\/raw\/.*\.(?:markdown|mdown|mkdn|md|mkd|mdwn|mdtxt|mdtext|text)(?:#.*|\?.*)?$
Alternatively, pull any of those repositories and access them on the file:/// origin locally.
The following instructions applies for: Chrome, Edge, Opera, Brave, Chromium and Vivaldi.
Note that in any of the following cases you won't receive any future updates automatically!
chrome://extensionsDeveloper mode switch is enabledchrome://extensionsDeveloper mode switch is enabledLoad unpacked button and select the extracted directorysh build/package.sh chrome (append compilers to include all available compilers)chrome://extensionsDeveloper mode switch is enabledLoad unpacked button and select the cloned directorychrome://extensionsDeveloper mode switch is enabledLoad unpacked button and select the cloned directoryThe MIT License (MIT)
Copyright (c) 2013-present, Simeon Velichkov [email protected] (https://github.com/simov/markdown-viewer)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.