simov 2 سال پیش
والد
کامیت
5bb21627f6
2فایلهای تغییر یافته به همراه83 افزوده شده و 83 حذف شده
  1. 62 58
      README.md
  2. 21 25
      firefox.md

+ 62 - 58
README.md

@@ -9,7 +9,7 @@
 - Render local and remote file URLs
 - Granular access to remote origins
 - Multiple markdown parsers
-- Full control over the compiler options ([marked][marked], [remark][remark])
+- Full control over the compiler options ([markdown-it], [marked], [remark])
 - 30+ Themes ([cleanrmd], [GitHub][github-theme])
 - GitHub Flavored Markdown (GFM)
 - Auto reload on file change
@@ -28,9 +28,9 @@
 # Table of Contents
 
 - **[After Install](#after-install)**
+- **[Themes](#themes)**
 - **[Compiler Options](#compiler-options)**
 - **[Content Options](#content-options)**
-- **[Themes](#themes)**
 - **[Manage Origins](#manage-origins)**
 - **[Syntax Examples](#syntax-examples)**
 
@@ -42,9 +42,11 @@
 
 1. Navigate to `chrome://extensions`
 2. Locate the Markdown Viewer extension and click on the `Details` button
-3. Make sure that the `Allow access to file URLs` switch is turned on
 
 ![img-extensions]
+
+3. Make sure that the `Allow access to file URLs` switch is turned on
+
 ![img-file-access]
 
 ## Remote Files
@@ -54,42 +56,56 @@
 
 ---
 
-# Compiler Options
+# Themes
 
-Markdown 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:
+All themes support the following width options:
 
-## Marked
+- `auto` - automatically adjust the content width based on the screen size
+- `full` - 100% screen width
+- `wide` - fixed at 1400px
+- `large` - fixed at 1200px
+- `medium` - fixed at 992px
+- `small` - fixed at 768px
+- `tiny` - fixed at 576px
 
-| 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.
+The `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 hosted on github.com
 
-## 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.
-| **sanitize**    | `false` | Sanitize the output. Ignore any HTML that has been input.
+# Compiler Options
 
-> For the rest of the supported compilers follow the [Manual Install](#manual-install) steps.
+Full **CommonMark** support including **GFM** tables and strikethrough **+**
+
+| Option         | Default | Description
+| :-             | :-:     | :-
+| **abbr**       | `false` | Abbreviation using `*[word]: Text` `<abbr>`
+| **attr**       | `false` | Custom attributes using `{}` curly brackets
+| **breaks**     | `false` | Convert new lines `\n` in paragraphs into line breaks `<br>`
+| **cjk**        | `false` | Suppress linebreaks between east asian characters
+| **deflist**    | `false` | Definition list `<dl>`
+| **footnote**   | `false` | Footnotes `[^1]` `[^1]: a`
+| **html**       | **`true`**  | Enable HTML tags in source
+| **ins**        | `false` | Inserted text `++a++` `<ins>`
+| **linkify**    | **`true`**  | Autoconvert URL-like text to links
+| **mark**       | `false` | Marked text `==a==` `<mark>`
+| **sub**        | `false` | Subscript `~a~` `<sub>`
+| **sup**        | `false` | Superscript `^a^` `<sup>`
+| **tasklists**  | `false` | Task lists `- [x]`
+| **typographer**| `false` | Enable some language-neutral replacement + quotes beautification
+| **xhtmlOut**   | `false` | Use `/` to close single tags (`<br />`)
 
 ---
 
 # Content Options
 
-| Option          | Default | Description
-| :-              | :-:     | :-
-| **autoreload**  | `false` | Auto reload on file change
-| **emoji**       | `false` | Convert emoji :shortnames: into EmojiOne images
-| **mathjax**     | `false` | Render MathJax formulas
-| **mermaid**     | `false` | Render Mermaid diagrams
-| **syntax**      | `true`  | Syntax highlighted fenced code blocks
-| **toc**         | `false` | Generate Table of Contents
+| Option         | Default | Description
+| :-             | :-:     | :-
+| **autoreload** | `false` | Auto reload on file change
+| **emoji**      | `false` | Convert emoji `:shortnames:` into EmojiOne images
+| **mathjax**    | `false` | Render MathJax formulas
+| **mermaid**    | `false` | Render Mermaid diagrams
+| **syntax**     | **`true`**  | Syntax highlighted fenced code blocks
+| **toc**        | `false` | Generate Table of Contents
 
 ## Autoreload
 
@@ -155,25 +171,9 @@ Generates Table of Contents (ToC) based on the headers found in the markdown doc
 
 ---
 
-# Themes
-
-All themes support the following width options:
-
-- `auto` - automatically adjust the content width based on the screen size
-- `full` - 100% screen width
-- `wide` - fixed at 1400px
-- `large` - fixed at 1200px
-- `medium` - fixed at 992px
-- `small` - fixed at 768px
-- `tiny` - fixed at 576px
-
-The `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 hosted on github.com
-
----
-
 # Manage Origins
 
-Click on the Markdown Viewer icon and select [Advanced Options](#manage-origins).
+Click on the Markdown Viewer icon and select `Advanced Options`.
 
 By default Markdown Viewer does not have access to any content:
 
@@ -183,7 +183,7 @@ By default Markdown Viewer does not have access to any content:
 
 To enable access to file URLs follow [these steps](#local-files).
 
-In case access to local files was not enabled you will see an additional `Allow Access` button next to the File Access header:
+In case access to local files was not enabled, an additional `Allow Access` button will be present next to the File Access header:
 
 ![img-file-access-allow]
 
@@ -195,9 +195,11 @@ Access to individual sites can be enabled by copy/pasting a URL address into the
 
 ![img-site-access-add]
 
-> Additionally the URL scheme can be replaced with a `*` to enable access to both `http` and `https`.
+> Access to both `http` and `https` protocols can be enabled by using a wildcard `*://raw.githubusercontent.com`
+
+> Access to all subdomains for a given hostname can be enabled by using a wildcard `https://*.githubusercontent.com`
 
-> Access to all subdomains for a host can be specified immediately after the protocol part: `https://*.mydomain.com`
+> Access to all ports on `localhost` can be enabled by specifying `http://localhost`, and access only to a specific port by specifying `http://localhost:3000`
 
 ## Allow on All Sites
 
@@ -230,15 +232,17 @@ It is a simple regular expression that matches URLs ending with:
 
 > 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.
+You can modify the path matching regular expression for each enabled origin. The settings are being updated as you type.
 
 ### Path Matching Priority
 
 The enabled origins are matched from most specific to least specific:
 
-1. `https://raw.githubusercontent.com` or `http://raw.githubusercontent.com`
-2. `*://raw.githubusercontent.com`
-3. `*://*`
+1. `https://raw.githubusercontent.com`
+2. `https://*.githubusercontent.com`
+3. `*://raw.githubusercontent.com`
+4. `*://*.githubusercontent.com`
+5. `*://*`
 
 The matching origin with the highest priority will be picked and its header detection and path matching settings will be used to determine if the content should be rendered or not.
 
@@ -250,9 +254,9 @@ Click on the `Remove` button for the origin that you want to remove. This remove
 
 ## Refresh 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.
+The extension synchronizes your preferences across all of your devices if you have logged into your browser and enabled the sync feature. The list of your allowed origins is being synced too. However, the actual permissions that you grant using the 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 the origin will be highlighted and an additional `Refresh` button will be present:
+In case you have enabled a new origin on some of your devices you will have to explicitly allow it on your other devices. In this case the origin will be highlighted and an additional `Refresh` button will be present:
 
 ![img-site-refresh]
 
@@ -272,7 +276,7 @@ Examples about the Markdown syntax and all features available in Markdown Viewer
 - **mermaid.md** - different types of Mermaid diagrams
 - **mathjax.md** - MathJax examples and support documentation
 
-Allow the appropriate remote origin or pull any of those repositories and access them on the `file:///` origin locally.
+Allow the appropriate remote origin or pull any of the above repositories and access it on the `file:///` origin locally.
 
 ---
 
@@ -300,7 +304,7 @@ Note that in any of the following cases you won't receive any future updates aut
 ## Build
 
 1. Clone this repository
-2. Execute `sh build/package.sh chrome` (append `compilers` to include all available compilers)
+2. Execute `sh build/package.sh chrome` (or `firefox` to build for Firefox)
 3. Navigate to `chrome://extensions`
 4. Make sure that the `Developer mode` switch is enabled
 5. Click on the `Load unpacked` button and select the cloned directory
@@ -349,10 +353,10 @@ SOFTWARE.
 
   [marked]: https://github.com/markedjs/marked
   [remark]: https://github.com/remarkjs/remark
-  [showdown]: https://github.com/showdownjs/showdown
   [markdown-it]: https://github.com/markdown-it/markdown-it
-  [remarkable]: https://github.com/jonschlinkert/remarkable
   [commonmark]: https://github.com/commonmark/commonmark.js
+  [showdown]: https://github.com/showdownjs/showdown
+  [remarkable]: https://github.com/jonschlinkert/remarkable
 
   [emojione]: https://emojione.com
   [mathjax]: https://www.mathjax.org

+ 21 - 25
firefox.md

@@ -1,14 +1,6 @@
 
 # Markdown Viewer on Firefox
 
-Unlike Chromium based browsers Firefox will try to download files with `text/markdown` content type. For that reason all markdown content have to be served with `text/plain` content type instead.
-
-On Linux [additional setup](#access-to-local-file-urls-on-linux) is needed on the local computer in order to serve local `file:///` URLs with `text/plain` content type.
-
-The `autoreload` feature won't work on `file:///` URLs because of CSP limitations, and it can only work on [local file server](#autoreload-on-localhost) setup on `http://localhost:[port]` or a host name that resolves to localhost.
-
-Lastly, remote origins that serve their content with [strict CSP](#remote-origins-with-strict-csp) won't be rendered at all even if they were enabled for the extension.
-
 ## Table of Contents
 
 - **[Access to local file:/// URLs on Linux](#access-to-local-file-urls-on-linux)**
@@ -17,18 +9,20 @@ Lastly, remote origins that serve their content with [strict CSP](#remote-origin
 
 ## Compatibility Matrix
 
-| Origin       | Type   | Headers                         | Render | Autoreload
-| :-           | :-     | :-                              | :-     | :-
-| `file:///`   | local  | requires mime type fix on Linux | ✔      | ✖
-| `http(s)://` | local  | text/plain                      | ✔      | ✔
-| `http(s)://` | remote | text/plain + non strict CSP     | ✔      | ✖
-| `http(s)://` | remote | strict CSP                      | ✖      | ✖
+| Origin       | Type   | Headers                                     | Render | Autoreload
+| :-           | :-:    | :-                                          | :-     | :-
+| `file:///`   | local  | requires mime type fix on Linux             | ✔      | ✖
+| `http(s)://` | local  | `content-type: text/plain`                  | ✔      | ✔
+| `http(s)://` | remote | `content-type: text/plain` + non strict CSP | ✔      | ✖
+| `http(s)://` | remote | strict CSP                                  | ✖      | ✖
 
 ---
 
 # Access to local file:/// URLs on Linux
 
-Firefox will try to download unknown file types by default. The following are a few methods to enable `file:///` access on Linux.
+Unlike Chromium based browsers Firefox will prompt you to download or open files with an external app, that are served with the `text/markdown` content type. For that reason markdown files have to be served using the `text/plain` content type instead.
+
+The following are a few methods to enable `file:///` access on Linux:
 
 ## Method 1
 
@@ -42,7 +36,7 @@ Restart Firefox
 
 ## Method 2
 
-In case Firefox was installed as a snap _Method 1_ from above won't work.
+In case Firefox was installed as a snap _Method 1_ won't work.
 
 Create `/home/me/snap/firefox/common/mime.types` file with the following content (replace `me` with your user):
 
@@ -84,9 +78,11 @@ update-mime-database ~/.local/share/mime
 
 # Autoreload on localhost
 
-The `autoreload` feature is available only for content served on `localhost`. You can use any file server as long as it serves the markdown files with `text/plain` content type.
+The `autoreload` feature is available only for content served on `localhost` and it won't work on `file:///` URLs because of CSP (Content Security Policy) limitations.
+
+Any file server can be used locally as long as it serves the markdown files with the `text/plain` content type.
 
-Here is an example file server with Node.js (replace `me` with your user):
+Here is an example file server using Node.js (replace `me` with your user):
 
 ```js
 var express = require('express')
@@ -113,17 +109,17 @@ express()
 
 Go to the Advanced Options page for the extension and enable the `http://localhost` origin (note that port is omitted).
 
-Run the above JavaScript file with Node.js and navigate to `http://localhost:8000` in Firefox.
+Run the above JavaScript file using Node.js and navigate to `http://localhost:8000` in Firefox.
 
-Note that you can use any other host name set in your `hosts` file that resolves to localhost:
+You can use any other host name configured in your `hosts` file that resolves to localhost:
 
 ```hosts
 127.0.0.1    ssd
 ```
 
-Then you only need to enable that origin `http://ssd` in the Advanced Options page.
+Then you only need to enable that origin `http://ssd` in the Advanced Options page as well.
 
-The above script can be run on system startup with SystemD or any other service manager.
+The above script can be run on system startup using SystemD or any other service manager.
 
 ---
 
@@ -131,14 +127,14 @@ The above script can be run on system startup with SystemD or any other service
 
 Remote origins that serve markdown files with `text/plain` content type and do not enforce strict CSP (Content Security Policy) can be enabled using the Advanced Options page.
 
-For example, content on `gitlab.com` and `bitbucket.org` can be enabled and subsequently it will be rendered:
+For example, content hosted on `gitlab.com` and `bitbucket.org` can be enabled and subsequently it will get rendered:
 
 - https://gitlab.com/simovelichkov/markdown-syntax/-/raw/main/README.md
 - https://bitbucket.org/simovelichkov/markdown-syntax/raw/main/README.md
 
-Remote origins with strict CSP, however, such as `default-src 'none'; style-src 'unsafe-inline'; sandbox ` are blocked by Firefox.
+Remote origins with strict CSP however, such as `content-security-policy: default-src 'none'; style-src 'unsafe-inline'; sandbox` will be blocked by Firefox.
 
-For example, content on GitHub's `raw.githubusercontent.com` won't be rendered even if that origin was enabled inside the Advanced Options page:
+For example, content hosted on GitHub's `raw.githubusercontent.com` cannot be rendered even if that origin was enabled in the Advanced Options page:
 
 - https://raw.githubusercontent.com/simov/markdown-syntax/main/README.md