Skip to content

Commit 24587ff

Browse files
authored
Merge branch 'develop' into remove-bundle-size
2 parents c32256f + 3f03e78 commit 24587ff

File tree

17 files changed

+2279
-1093
lines changed

17 files changed

+2279
-1093
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module.exports = {
1919
rules: {
2020
'prettier/prettier': ['error'],
2121
camelcase: ['warn'],
22+
'no-useless-escape': ['warn'],
2223
curly: ['error', 'all'],
2324
'dot-notation': ['error'],
2425
eqeqeq: ['error'],

CHANGELOG.md

+29
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
## [4.11.4](https://github.com/docsifyjs/docsify/compare/v4.11.3...v4.11.4) (2020-06-18)
2+
3+
4+
### Bug Fixes
5+
6+
* consistent location of search result ([e9dd2de](https://github.com/docsifyjs/docsify/commit/e9dd2de384b81619aae2bcbf92f52721cb76a177))
7+
* cover overlapping sidebar by removing z-index ([0bf03f5](https://github.com/docsifyjs/docsify/commit/0bf03f58103037d100b1635cf3989c8d3672b4ba))
8+
* 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)
9+
* default html img resize if no height included ([#1065](https://github.com/docsifyjs/docsify/issues/1065)) ([9ff4d06](https://github.com/docsifyjs/docsify/commit/9ff4d0677304bc190e7bd9e89bbbdc64895197fa))
10+
* fixed target and rel issue (fixes [#1183](https://github.com/docsifyjs/docsify/issues/1183)) ([3d662a5](https://github.com/docsifyjs/docsify/commit/3d662a5bf71bbfef077cfbc478df241d794f55a0))
11+
* Inconsistent search and body rendering ([dcb0aae](https://github.com/docsifyjs/docsify/commit/dcb0aaea99efbd68175f1d1aeb5076b6dde9801e))
12+
* rendering cover width bug ([717991c](https://github.com/docsifyjs/docsify/commit/717991c90cf709f4da91fe32610129de6529266b))
13+
* 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))
14+
* 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))
15+
* upgrade docsify from 4.10.2 to 4.11.2 ([60b7f89](https://github.com/docsifyjs/docsify/commit/60b7f89b373b0d48ec8406a51eddeaed8126696d))
16+
17+
18+
### Features
19+
20+
* added html sanitizer for remote rendering ([#1128](https://github.com/docsifyjs/docsify/issues/1128)) ([714ef29](https://github.com/docsifyjs/docsify/commit/714ef29afe779a6db5c4761ebaacdfc70ee2d8dd))
21+
* 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))
22+
23+
24+
### Reverts
25+
26+
* 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)
27+
28+
29+
130
## [4.11.3](https://github.com/docsifyjs/docsify/compare/v4.11.2...v4.11.3) (2020-03-24)
231

332

build/build.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,17 @@ async function build(opts) {
2929
__VERSION__: version,
3030
'process.env.SSR': false
3131
})
32-
])
32+
]),
33+
onwarn: function (message) {
34+
if (message.code === 'UNRESOLVED_IMPORT') {
35+
throw new Error(
36+
`Could not resolve module ` +
37+
message.source +
38+
`. Try running 'npm install' or using rollup's 'external' option if this is an external dependency. ` +
39+
`Module ${message.source} is imported in ${message.importer}`
40+
)
41+
}
42+
}
3343
})
3444
.then(function (bundle) {
3545
var dest = 'lib/' + (opts.output || opts.input)

docs/_coverpage.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![logo](_media/icon.svg)
22

3-
# docsify <small>4.11.3</small>
3+
# docsify <small>4.11.4</small>
44

55
> A magical documentation site generator.
66

docs/deploy.md

+46
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,49 @@ frontend:
135135
| /<*>.md | /<*>.md | 200 (Rewrite) |
136136
| /<*>.png | /<*>.png | 200 (Rewrite) |
137137
| /<*> | /index.html | 200 (Rewrite) |
138+
139+
140+
## Docker
141+
142+
- Create docsify files
143+
144+
You need prepare the initial files instead of making in container.
145+
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).
146+
147+
```sh
148+
index.html
149+
README.md
150+
```
151+
152+
- Create dockerfile
153+
154+
```Dockerfile
155+
FROM node:latest
156+
LABEL description="A demo Dockerfile for build Docsify."
157+
WORKDIR /docs
158+
RUN npm install -g docsify-cli@latest
159+
EXPOSE 3000/tcp
160+
ENTRYPOINT docsify serve .
161+
162+
```
163+
164+
So, current directory structure should be this:
165+
166+
```sh
167+
index.html
168+
README.md
169+
Dockerfile
170+
```
171+
172+
- Build docker image
173+
174+
```sh
175+
docker build -f Dockerfile -t docsify/demo .
176+
```
177+
178+
- Run docker image
179+
180+
```sh
181+
docker run -itp 3000:3000 --name=docsify -v $(pwd):/docs docsify/demo
182+
```
183+

docs/embed-files.md

+84-6
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,44 @@
11
# Embed files
22

33
With docsify 4.6 it is now possible to embed any type of file.
4+
45
You can embed these files as video, audio, iframes, or code blocks, and even Markdown files can even be embedded directly into the document.
56

6-
For example, here embedded a Markdown file. You only need to do this:
7+
For example, here is an embedded Markdown file. You only need to do this:
78

89
```markdown
910
[filename](_media/example.md ':include')
1011
```
1112

12-
Then the content of `example.md` will be displayed directly here
13+
Then the content of `example.md` will be displayed directly here;
1314

1415
[filename](_media/example.md ':include')
1516

1617
You can check the original content for [example.md](_media/example.md ':ignore').
1718

1819
Normally, this will compiled into a link, but in docsify, if you add `:include` it will be embedded.
1920

21+
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.
22+
2023
## Embedded file type
2124

22-
Currently, file extension are automatically recognized and embedded in different ways.
25+
Currently, file extensions are automatically recognized and embedded in different ways.
2326

24-
This is a supported embedding type:
27+
These types are supported:
2528

2629
* **iframe** `.html`, `.htm`
2730
* **markdown** `.markdown`, `.md`
2831
* **audio** `.mp3`
2932
* **video** `.mp4`, `.ogg`
3033
* **code** other file extension
3134

32-
Of course, you can force the specified. For example, you want to Markdown file as code block embedded.
35+
Of course, you can force the specified type. For example, a Markdown file can be embedded as a code block by setting `:type=code`.
3336

3437
```markdown
3538
[filename](_media/example.md ':include :type=code')
3639
```
3740

38-
You will get it
41+
You will get:
3942

4043
[filename](_media/example.md ':include :type=code')
4144

@@ -91,3 +94,78 @@ Embedding any type of source code file, you can specify the highlighted language
9194
[](_media/example.html ':include :type=code text')
9295

9396
?> How to set highlight? You can see [here](language-highlight.md).
97+
98+
## Embed a gist
99+
100+
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.
101+
102+
?> **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.
103+
104+
### Identify the gist's metadata
105+
106+
Start by viewing a gist on `gist.github.com`. For the purposes of this guide, we use this gist:
107+
108+
- https://gist.github.com/anikethsaha/f88893bb563bb7229d6e575db53a8c15
109+
110+
Identify the following items from the gist:
111+
112+
Field | Example | Description
113+
--- | --- | ---
114+
**Username** | `anikethsaha` | The gist's owner.
115+
**Gist ID** | `c2bece08f27c4277001f123898d16a7c` | Identifier for the gist. This is fixed for the gist's lifetime.
116+
**Filename** | `content.md` | Select a name of a file in the gist. This needed even on a single-file gist for embedding to work.
117+
118+
You will need those to build the _raw gist URL_ for the target file. This has the following format:
119+
120+
- `https://gist.githubusercontent.com/USERNAME/GIST_ID/raw/FILENAME`
121+
122+
Here are two examples based on the sample gist:
123+
124+
- https://gist.githubusercontent.com/anikethsaha/f88893bb563bb7229d6e575db53a8c15/raw/content.md
125+
- https://gist.githubusercontent.com/anikethsaha/f88893bb563bb7229d6e575db53a8c15/raw/script.js
126+
127+
?> 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.
128+
129+
Continue with one of the sections below to embed the gist on a Docsify page.
130+
131+
### Render markdown content from a gist
132+
133+
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.
134+
135+
Here is the format:
136+
137+
```markdown
138+
[LABEL](https://gist.githubusercontent.com/USERNAME/GIST_ID/raw/FILENAME ':include')
139+
```
140+
141+
For example:
142+
143+
```markdown
144+
[gist: content.md](https://gist.githubusercontent.com/anikethsaha/f88893bb563bb7229d6e575db53a8c15/raw/content.md ':include')
145+
```
146+
147+
Which renders as:
148+
149+
[gist: content.md](https://gist.githubusercontent.com/anikethsaha/f88893bb563bb7229d6e575db53a8c15/raw/content.md ':include')
150+
151+
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.
152+
153+
### Render a codeblock from a gist
154+
155+
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`.
156+
157+
Here is the format:
158+
159+
```markdown
160+
[LABEL](https://gist.githubusercontent.com/USERNAME/GIST_ID/raw/FILENAME ':include :type=code')
161+
```
162+
163+
For example:
164+
165+
```markdown
166+
[gist: script.js](https://gist.githubusercontent.com/anikethsaha/f88893bb563bb7229d6e575db53a8c15/raw/script.js ':include :type=code')
167+
```
168+
169+
Which renders as:
170+
171+
[gist: script.js](https://gist.githubusercontent.com/anikethsaha/f88893bb563bb7229d6e575db53a8c15/raw/script.js ':include :type=code')

docs/quickstart.md

+26-6
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ If you don't like `npm` or have trouble installing the tool, you can manually cr
4747
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
4848
<meta name="viewport" content="width=device-width,initial-scale=1">
4949
<meta charset="UTF-8">
50-
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/vue.css">
50+
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/themes/vue.css" />
5151
</head>
5252
<body>
5353
<div id="app"></div>
@@ -56,11 +56,31 @@ If you don't like `npm` or have trouble installing the tool, you can manually cr
5656
//...
5757
}
5858
</script>
59-
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
59+
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
6060
</body>
6161
</html>
6262
```
6363

64+
### Specifying docsify versions
65+
66+
?> Note that in both of the examples below, docsify URLs will need to be manually updated when a new major version of docsify is released (e.g. `v4.x.x` => `v5.x.x`). Check the docsify website periodically to see if a new major version has been released.
67+
68+
Specifying a major version in the URL (`@4`) will allow your site will receive non-breaking enhancements (i.e. "minor" updates) and bug fixes (i.e. "patch" updates) automatically. This is the recommended way to load docsify resources.
69+
70+
```html
71+
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/themes/vue.css" />
72+
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
73+
```
74+
75+
If you prefer to lock docsify to a specific version, specify the full version after the `@` symbol in the URL. This is the safest way to ensure your site will look and behave the same way regardless of any changes made to future versions of docsify.
76+
77+
```html
78+
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4.11.4/themes/vue.css">
79+
<script src="//cdn.jsdelivr.net/npm/docsify@4.11.4"></script>
80+
```
81+
82+
### Manually preview your site
83+
6484
If you installed python on your system, you can easily use it to run a static server to preview your site.
6585

6686
```bash
@@ -72,17 +92,17 @@ cd docs && python -m SimpleHTTPServer 3000
7292
If you want, you can show a loading dialog before docsify starts to render your documentation:
7393

7494
```html
75-
<!-- index.html -->
95+
<!-- index.html -->
7696

77-
<div id="app">Please wait...</div>
97+
<div id="app">Please wait...</div>
7898
```
7999

80100
You should set the `data-app` attribute if you changed `el`:
81101

82102
```html
83-
<!-- index.html -->
103+
<!-- index.html -->
84104

85-
<div data-app id="main">Please wait...</div>
105+
<div data-app id="main">Please wait...</div>
86106

87107
<script>
88108
window.$docsify = {

0 commit comments

Comments
 (0)