diff --git a/.eslintrc.js b/.eslintrc.js index 087ae9e76..d08568536 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -19,6 +19,7 @@ module.exports = { rules: { 'prettier/prettier': ['error'], camelcase: ['warn'], + 'no-useless-escape': ['warn'], curly: ['error', 'all'], 'dot-notation': ['error'], eqeqeq: ['error'], diff --git a/CHANGELOG.md b/CHANGELOG.md index b53241891..784dec697 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,32 @@ +## [4.11.4](https://github.com/docsifyjs/docsify/compare/v4.11.3...v4.11.4) (2020-06-18) + + +### Bug Fixes + +* consistent location of search result ([e9dd2de](https://github.com/docsifyjs/docsify/commit/e9dd2de384b81619aae2bcbf92f52721cb76a177)) +* cover overlapping sidebar by removing z-index ([0bf03f5](https://github.com/docsifyjs/docsify/commit/0bf03f58103037d100b1635cf3989c8d3672b4ba)) +* cross-origin url cannot be redirected when "externalLinkTarget" is set to "_self" and "routerMode" is set to "history". ([#1062](https://github.com/docsifyjs/docsify/issues/1062)) ([fd2cec6](https://github.com/docsifyjs/docsify/commit/fd2cec6bd66c46d6957811fefae4c615c3052a4f)), closes [#1046](https://github.com/docsifyjs/docsify/issues/1046) [#1046](https://github.com/docsifyjs/docsify/issues/1046) [#1046](https://github.com/docsifyjs/docsify/issues/1046) +* default html img resize if no height included ([#1065](https://github.com/docsifyjs/docsify/issues/1065)) ([9ff4d06](https://github.com/docsifyjs/docsify/commit/9ff4d0677304bc190e7bd9e89bbbdc64895197fa)) +* fixed target and rel issue (fixes [#1183](https://github.com/docsifyjs/docsify/issues/1183)) ([3d662a5](https://github.com/docsifyjs/docsify/commit/3d662a5bf71bbfef077cfbc478df241d794f55a0)) +* Inconsistent search and body rendering ([dcb0aae](https://github.com/docsifyjs/docsify/commit/dcb0aaea99efbd68175f1d1aeb5076b6dde9801e)) +* rendering cover width bug ([717991c](https://github.com/docsifyjs/docsify/commit/717991c90cf709f4da91fe32610129de6529266b)) +* search does not find the contents of the table ([#1198](https://github.com/docsifyjs/docsify/issues/1198)) ([31010e4](https://github.com/docsifyjs/docsify/commit/31010e4979b3d3ab4bd247a09c4ac5fd1405eaa8)) +* The search error after setting the ID in the title ([#1159](https://github.com/docsifyjs/docsify/issues/1159)) ([6e554f8](https://github.com/docsifyjs/docsify/commit/6e554f8ebd3d4a2c5c7e4f66cff3dfe2b6aa1e31)) +* upgrade docsify from 4.10.2 to 4.11.2 ([60b7f89](https://github.com/docsifyjs/docsify/commit/60b7f89b373b0d48ec8406a51eddeaed8126696d)) + + +### Features + +* added html sanitizer for remote rendering ([#1128](https://github.com/docsifyjs/docsify/issues/1128)) ([714ef29](https://github.com/docsifyjs/docsify/commit/714ef29afe779a6db5c4761ebaacdfc70ee2d8dd)) +* update src/core/index.js to export all global APIs, deprecate old globals in favor of a single global DOCSIFY, and add tests for this ([7e002bf](https://github.com/docsifyjs/docsify/commit/7e002bf939d7837843908417b5445b4f8d36c1cd)) + + +### Reverts + +* Revert "Updated docs site dark and light mode with switch and redesigned search bar using docsify-darklight-theme" (#1207) ([26cb940](https://github.com/docsifyjs/docsify/commit/26cb940b51d34ee584b8425012a336f38a4abd76)), closes [#1207](https://github.com/docsifyjs/docsify/issues/1207) [#1182](https://github.com/docsifyjs/docsify/issues/1182) + + + ## [4.11.3](https://github.com/docsifyjs/docsify/compare/v4.11.2...v4.11.3) (2020-03-24) diff --git a/README.md b/README.md index fdef0a95d..998f5add9 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@

Backers on Open Collective - Sponsors on Open Collective + Sponsors on Open Collective Unit tests Suite Linting Checks Testing the e2e test suites @@ -41,7 +41,7 @@ ## Features - No statically built html files -- Simple and lightweight (~21kB gzipped) +- Simple and lightweight - Smart full-text search plugin - Multiple themes - Useful plugin API diff --git a/build/build.js b/build/build.js index 9b1a80b3a..bf70dc4e5 100644 --- a/build/build.js +++ b/build/build.js @@ -29,7 +29,17 @@ async function build(opts) { __VERSION__: version, 'process.env.SSR': false }) - ]) + ]), + onwarn: function (message) { + if (message.code === 'UNRESOLVED_IMPORT') { + throw new Error( + `Could not resolve module ` + + message.source + + `. Try running 'npm install' or using rollup's 'external' option if this is an external dependency. ` + + `Module ${message.source} is imported in ${message.importer}` + ) + } + } }) .then(function (bundle) { var dest = 'lib/' + (opts.output || opts.input) diff --git a/cypress/fixtures/tpl/docs.index.html b/cypress/fixtures/tpl/docs.index.html index 6a8b41a4c..a4b4c831f 100644 --- a/cypress/fixtures/tpl/docs.index.html +++ b/cypress/fixtures/tpl/docs.index.html @@ -1,123 +1,111 @@ - - - docsify-e2e-tests - - - - - - - - - - - - - - -

Loading Docsify e2e tests suite...
- - - - - - - - + paths: 'auto', + placeholder: { + '/de-de/': 'Suche', + '/zh-cn/': '搜索', + '/': 'Search' + } + }, + formatUpdated: '{MM}/{DD} {HH}:{mm}', + plugins: [ + function (hook, vm) { + hook.beforeEach(function (html) { + if (/githubusercontent\.com/.test(vm.route.file)) { + url = vm.route.file + .replace('raw.githubusercontent.com', 'github.com') + .replace(/\/master/, '/blob/master') + } else { + url = + 'https://github.com/docsifyjs/docsify/blob/master/docs/' + + vm.route.file + } + var editHtml = '[:memo: Edit Document](' + url + ')\n' + return ( + editHtml + + html + + '\n\n----\n\n' + + 'Powered by docsify' + ) + }) + } + ] + } + + + + + + + + - - - - + + + + + \ No newline at end of file diff --git a/cypress/integration/sidebar/config.spec.js b/cypress/integration/sidebar/config.spec.js index 4c1b511a7..f1e2b454f 100644 --- a/cypress/integration/sidebar/config.spec.js +++ b/cypress/integration/sidebar/config.spec.js @@ -157,7 +157,6 @@ context('sidebar.configurations', () => { 'disqus', 'gitalk', 'pagination', - 'codefund', 'tabs', 'more-plugins', ]; diff --git a/docs/README.md b/docs/README.md index e62542032..a0c6c9e0f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -11,7 +11,7 @@ See the [Quick start](quickstart.md) guide for more details. ## Features - No statically built html files -- Simple and lightweight (~21kB gzipped) +- Simple and lightweight - Smart full-text search plugin - Multiple themes - Useful plugin API diff --git a/docs/_coverpage.md b/docs/_coverpage.md index 42652e104..07c318651 100644 --- a/docs/_coverpage.md +++ b/docs/_coverpage.md @@ -1,10 +1,10 @@ ![logo](_media/icon.svg) -# docsify 4.11.3 +# docsify 4.11.4 > A magical documentation site generator. -- Simple and lightweight (~21kB gzipped) +- Simple and lightweight - No statically built html files - Multiple themes diff --git a/docs/cover.md b/docs/cover.md index f2a0ce2d4..a8da3083d 100644 --- a/docs/cover.md +++ b/docs/cover.md @@ -26,7 +26,7 @@ Set `coverpage` to **true**, and create a `_coverpage.md`: > A magical documentation site generator. -- Simple and lightweight (~21kB gzipped) +- Simple and lightweight - No statically built html files - Multiple themes diff --git a/docs/deploy.md b/docs/deploy.md index d68b5c9dc..2c96060f9 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -135,3 +135,49 @@ frontend: | /<*>.md | /<*>.md | 200 (Rewrite) | | /<*>.png | /<*>.png | 200 (Rewrite) | | /<*> | /index.html | 200 (Rewrite) | + + +## Docker + +- Create docsify files + + You need prepare the initial files instead of making in container. + See the [Quickstart](https://docsify.js.org/#/quickstart) section for instructions on how to create these files manually or using [docsify-cli](https://github.com/docsifyjs/docsify-cli). + + ```sh + index.html + README.md + ``` + +- Create dockerfile + + ```Dockerfile + FROM node:latest + LABEL description="A demo Dockerfile for build Docsify." + WORKDIR /docs + RUN npm install -g docsify-cli@latest + EXPOSE 3000/tcp + ENTRYPOINT docsify serve . + + ``` + + So, current directory structure should be this: + + ```sh + index.html + README.md + Dockerfile + ``` + +- Build docker image + + ```sh + docker build -f Dockerfile -t docsify/demo . + ``` + +- Run docker image + + ```sh + docker run -itp 3000:3000 --name=docsify -v $(pwd):/docs docsify/demo + ``` + diff --git a/docs/embed-files.md b/docs/embed-files.md index d50387477..d1a447338 100644 --- a/docs/embed-files.md +++ b/docs/embed-files.md @@ -1,15 +1,16 @@ # Embed files With docsify 4.6 it is now possible to embed any type of file. + You can embed these files as video, audio, iframes, or code blocks, and even Markdown files can even be embedded directly into the document. -For example, here embedded a Markdown file. You only need to do this: +For example, here is an embedded Markdown file. You only need to do this: ```markdown [filename](_media/example.md ':include') ``` -Then the content of `example.md` will be displayed directly here +Then the content of `example.md` will be displayed directly here; [filename](_media/example.md ':include') @@ -17,11 +18,13 @@ You can check the original content for [example.md](_media/example.md ':ignore') Normally, this will compiled into a link, but in docsify, if you add `:include` it will be embedded. +External links can be used too - just replace the target. If you want to use a gist URL, see [Embed a gist](#embed-a-gist) section. + ## Embedded file type -Currently, file extension are automatically recognized and embedded in different ways. +Currently, file extensions are automatically recognized and embedded in different ways. -This is a supported embedding type: +These types are supported: * **iframe** `.html`, `.htm` * **markdown** `.markdown`, `.md` @@ -29,13 +32,13 @@ This is a supported embedding type: * **video** `.mp4`, `.ogg` * **code** other file extension -Of course, you can force the specified. For example, you want to Markdown file as code block embedded. +Of course, you can force the specified type. For example, a Markdown file can be embedded as a code block by setting `:type=code`. ```markdown [filename](_media/example.md ':include :type=code') ``` -You will get it +You will get: [filename](_media/example.md ':include :type=code') @@ -91,3 +94,78 @@ Embedding any type of source code file, you can specify the highlighted language [](_media/example.html ':include :type=code text') ?> How to set highlight? You can see [here](language-highlight.md). + +## Embed a gist + +You can embed a gist as markdown content or as a code block - this is based on the approach at the start of [Embed Files](#embed-files) section, but uses a raw gist URL as the target. + +?> **No** plugin or app config change is needed here to make this work. In fact, the "Embed" `script` tag that is copied from a gist will _not_ load even if you make plugin or config changes to allow an external script. + +### Identify the gist's metadata + +Start by viewing a gist on `gist.github.com`. For the purposes of this guide, we use this gist: + +- https://gist.github.com/anikethsaha/f88893bb563bb7229d6e575db53a8c15 + +Identify the following items from the gist: + +Field | Example | Description +--- | --- | --- +**Username** | `anikethsaha` | The gist's owner. +**Gist ID** | `c2bece08f27c4277001f123898d16a7c` | Identifier for the gist. This is fixed for the gist's lifetime. +**Filename** | `content.md` | Select a name of a file in the gist. This needed even on a single-file gist for embedding to work. + +You will need those to build the _raw gist URL_ for the target file. This has the following format: + +- `https://gist.githubusercontent.com/USERNAME/GIST_ID/raw/FILENAME` + +Here are two examples based on the sample gist: + +- https://gist.githubusercontent.com/anikethsaha/f88893bb563bb7229d6e575db53a8c15/raw/content.md +- https://gist.githubusercontent.com/anikethsaha/f88893bb563bb7229d6e575db53a8c15/raw/script.js + +?> Alternatively, you can get a raw URL directly clicking the _Raw_ button on a gist file. But, if you use that approach, just be sure to **remove** the revision number between `raw/` and the filename so that the URL matches the pattern above instead. Otherwise your embedded gist will **not** show the latest content when the gist is updated. + +Continue with one of the sections below to embed the gist on a Docsify page. + +### Render markdown content from a gist + +This is a great way to embed content **seamlessly** in your docs, without sending someone to an external link. This approach is well-suited to reusing a gist of say installation instructions across doc sites of multiple repos. This approach works equally well with a gist owned by your account or by another user. + +Here is the format: + +```markdown +[LABEL](https://gist.githubusercontent.com/USERNAME/GIST_ID/raw/FILENAME ':include') +``` + +For example: + +```markdown +[gist: content.md](https://gist.githubusercontent.com/anikethsaha/f88893bb563bb7229d6e575db53a8c15/raw/content.md ':include') +``` + +Which renders as: + +[gist: content.md](https://gist.githubusercontent.com/anikethsaha/f88893bb563bb7229d6e575db53a8c15/raw/content.md ':include') + +The `LABEL` can be any text you want. It acts as a _fallback_ message if the link is broken - so it is useful to repeat the filename here in case you need to fix a broken link. It also makes an embedded element easy to read at a glance. + +### Render a codeblock from a gist + +The format is the same as the previous section, but with `:type=code` added to the alt text. As with the [Embedded file type](#embedded-file-type) section, the syntax highlighting will be **inferred** from the extension (e.g. `.js` or `.py`), so you can leave the `type` set as `code`. + +Here is the format: + +```markdown +[LABEL](https://gist.githubusercontent.com/USERNAME/GIST_ID/raw/FILENAME ':include :type=code') +``` + +For example: + +```markdown +[gist: script.js](https://gist.githubusercontent.com/anikethsaha/f88893bb563bb7229d6e575db53a8c15/raw/script.js ':include :type=code') +``` + +Which renders as: + +[gist: script.js](https://gist.githubusercontent.com/anikethsaha/f88893bb563bb7229d6e575db53a8c15/raw/script.js ':include :type=code') diff --git a/docs/index.html b/docs/index.html index 050b21dde..c6957a7f3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -15,8 +15,6 @@ - -