Skip to content

[Release]: v4.11.4 #1190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 81 commits into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
60b7f89
fix: upgrade docsify from 4.10.2 to 4.11.2
snyk-bot Mar 31, 2020
957609a
Merge pull request #1099 from docsifyjs/snyk-upgrade-82b6c6427661ce91…
anikethsaha Apr 3, 2020
ea17dcc
updated the insertion of embedded tokens so it correctly handles embe…
Apr 2, 2020
96d5b19
chore: update auto format config
jamesgeorge007 Apr 9, 2020
d32d91b
Update sidebar.js
CHU295 Apr 10, 2020
b4e7b21
Update component.js
CHU295 Apr 10, 2020
517f0d7
[fix #1115] Image resize in % doesn't work.
Koooooo-7 Apr 13, 2020
39320bb
Merge pull request #1116 from docsifyjs/fix1115
anikethsaha Apr 13, 2020
fed6a83
Linting Checks
CHU295 Apr 15, 2020
1c43abe
Linting Checks
CHU295 Apr 15, 2020
dcb0aae
fix: Inconsistent search and body rendering
sy-records Apr 19, 2020
b2e6123
Update nameLink option docs (#1125)
trusktr Apr 19, 2020
2623b94
Update index.html (#1144)
sy-records Apr 27, 2020
b108c86
reset and modify.
vagra Apr 27, 2020
717991c
fix: rendering cover width bug
HerbertHe Apr 27, 2020
b05949a
Add front matter to dev page
sytone Apr 27, 2020
468ee2d
Improve accessibility of viewport meta
Apr 27, 2020
0bbc02c
Modify Chinese doc link (#1151)
sy-records Apr 28, 2020
2cf6fd8
fix Edit Document
sy-records Apr 28, 2020
b2dd708
Merge pull request #1146 from vagra/bugfix
anikethsaha May 3, 2020
d5a7507
Fix typo on `externalLinkRel`
dungahk May 4, 2020
79928de
Merge pull request #1156 from dungahk/patch-1
anikethsaha May 7, 2020
fd5ed35
Merge pull request #1149 from chicgeek/feature/viewport-meta-accessib…
anikethsaha May 7, 2020
22030f4
Merge pull request #1148 from sytone/develop
anikethsaha May 7, 2020
eb1a3ce
Merge pull request #1152 from sy-records/fix-edit-on-github
anikethsaha May 7, 2020
7d38a32
Create sidebar.js
sy-records May 13, 2020
6ac71f9
Delete sidebar.js
sy-records May 13, 2020
f9d0c72
Create sidebar.js
sy-records May 13, 2020
62d0986
Delete sidebar.js
sy-records May 13, 2020
f2ff01d
Update component.js
sy-records May 14, 2020
708ca9d
Merge pull request #1111 from CHU295/develop
anikethsaha May 14, 2020
6e554f8
fix: The search error after setting the ID in the title (#1159)
sy-records May 14, 2020
fd2cec6
fix: cross-origin url cannot be redirected when "externalLinkTarget"…
Koooooo-7 May 15, 2020
455f4c4
docs(configuration): mention active link pitfall for the homepage
zhouzi May 12, 2020
aad80f9
Merge pull request #1174 from Zhouzi/patch-1
anikethsaha May 15, 2020
699172d
Cursor pointer added for search clear button
kumaravel95 May 16, 2020
a117b2a
Merge pull request #1177 from kumaravel95/develop
anikethsaha May 16, 2020
9ff4d06
fix: default html img resize if no height included (#1065)
maubuz May 18, 2020
3d662a5
fix: fixed target and rel issue (fixes #1183)
anikethsaha May 20, 2020
f72bf4c
allow the user's $docsify config to be a function that receives as in…
trusktr May 22, 2020
b4b8bdc
add tests to make sure the global and plugin APIs are available and t…
trusktr May 22, 2020
732c34d
add editorconfig (tells editors which basic text format to use)
trusktr May 22, 2020
5a5b5aa
update docs regarding configs as functions
trusktr May 22, 2020
c0d3280
Merge pull request #1186 from anikethsaha/fixes-1183
anikethsaha May 22, 2020
e9dd2de
fix: consistent location of search result
sy-records May 22, 2020
bd9e24b
Merge pull request #1147 from HerbertHe/patch-1
anikethsaha May 22, 2020
5ea28c4
Merge pull request #1102 from tschaible/bugfix/multiple-embeds
anikethsaha May 22, 2020
415f295
update: updated docs site dark and light mode with switch and redesig…
boopathikumar018 May 22, 2020
1a09ce3
Fix: emoji +1 and -1 not rendering (#1187)
sy-records May 23, 2020
b72cb3d
add build error handling so builds don't silently fail
trusktr May 23, 2020
7e002bf
feat: update src/core/index.js to export all global APIs, deprecate o…
trusktr May 23, 2020
b40baae
Merge pull request #1195 from docsifyjs/deprecate-old-globals-and-mak…
trusktr May 23, 2020
1b8a81a
Merge pull request #1192 from docsifyjs/add-build-error-handling
trusktr May 23, 2020
fa0dfa6
ci: added configuration for semantic bot
anikethsaha May 27, 2020
4514cfb
Merge pull request #1199 from docsifyjs/config-semantic
anikethsaha May 27, 2020
43055be
ci: fixed semantic config
anikethsaha May 27, 2020
6026357
Merge pull request #1201 from docsifyjs/config-semantic
anikethsaha May 27, 2020
31010e4
fix: search does not find the contents of the table (#1198)
sy-records Jun 7, 2020
88033b6
remove the DOCSIFY global made by Rollup, and move Docsify into a sep…
trusktr Jun 7, 2020
79fe3d5
remove some unused code and accept eslint changes
trusktr Jun 7, 2020
dca22f3
simplify import
trusktr Jun 7, 2020
41dc2c7
ensure that the test script runs a prod build
trusktr Jun 7, 2020
31f1a64
update outdated comment
trusktr Jun 7, 2020
63f1b88
Revert "ensure that the test script runs a prod build"
trusktr Jun 7, 2020
7853026
style: Get emoji from github api (#1188)
sy-records Jun 7, 2020
809fda9
Merge branch 'develop' into allow-config-function
trusktr Jun 7, 2020
817c079
ci: added codesandbox build preview for PR reviews (#1193)
anikethsaha Jun 8, 2020
72ec71f
Merge branch 'develop' into allow-config-function
trusktr Jun 8, 2020
26cb940
Revert "Updated docs site dark and light mode with switch and redesig…
anikethsaha Jun 9, 2020
0438dd6
Merge branch 'develop' into allow-config-function
trusktr Jun 9, 2020
7f835b1
Merge branch 'develop' into update-config
jamesgeorge007 Jun 10, 2020
64a231d
use a port for the tests that doesn't collide with common local serve…
trusktr Jun 10, 2020
fa47c6f
Merge branch 'master' into develop
trusktr Jun 10, 2020
abaf6f3
Merge branch 'develop' into allow-config-function
trusktr Jun 10, 2020
d9d3251
Merge branch 'develop' into update-config
trusktr Jun 10, 2020
a1ddb3c
Merge pull request #1108 from jamesgeorge007/update-config
trusktr Jun 10, 2020
8f3f263
Merge branch 'develop' into allow-config-function
trusktr Jun 13, 2020
146e4c4
Update build/css.js
trusktr Jun 13, 2020
da9af18
Merge pull request #1189 from docsifyjs/allow-config-function
trusktr Jun 13, 2020
0bf03f5
fix: cover overlapping sidebar by removing z-index
mohammedsahl Jun 15, 2020
714ef29
feat: added html sanitizer for remote rendering (#1128)
anikethsaha Jun 17, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"sandboxes": ["2d17z"],
"packages": [".", "packages/docsify-server-renderer"]
}
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# http://EditorConfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = {
rules: {
'prettier/prettier': ['error'],
camelcase: ['warn'],
'no-useless-escape': ['warn'],
curly: ['error', 'all'],
'dot-notation': ['error'],
eqeqeq: ['error'],
Expand Down
4 changes: 4 additions & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
titleAndCommits: true
allowMergeCommits: true
allowRevertCommits: true
anyCommit: true
122 changes: 73 additions & 49 deletions build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ const version = process.env.VERSION || require('../package.json').version
const chokidar = require('chokidar')
const path = require('path')

const build = function (opts) {
rollup
/**
* @param {{
* input: string,
* output?: string,
* globalName?: string,
* plugins?: Array<import('rollup').Plugin>
* }} opts
*/
async function build(opts) {
await rollup
.rollup({
input: opts.input,
plugins: (opts.plugins || []).concat([
Expand All @@ -27,31 +35,35 @@ const build = function (opts) {
var dest = 'lib/' + (opts.output || opts.input)

console.log(dest)
bundle.write({
return bundle.write({
format: 'iife',
output: opts.globalName ? {name: opts.globalName} : {},
file: dest,
strict: false
})
})
.catch(function (err) {
console.error(err)
})
}
const buildCore = function () {
build({

async function buildCore() {
const promises = []

promises.push(build({
input: 'src/core/index.js',
output: 'docsify.js'
})
output: 'docsify.js',
}))

if (isProd) {
build({
promises.push(build({
input: 'src/core/index.js',
output: 'docsify.min.js',
plugins: [uglify()]
})
}))
}

await Promise.all(promises)
}
const buildAllPlugin = function () {

async function buildAllPlugin() {
var plugins = [
{name: 'search', input: 'search/index.js'},
{name: 'ga', input: 'ga.js'},
Expand All @@ -64,56 +76,68 @@ const buildAllPlugin = function () {
{name: 'gitalk', input: 'gitalk.js'}
]

plugins.forEach(item => {
build({
const promises = plugins.map(item => {
return build({
input: 'src/plugins/' + item.input,
output: 'plugins/' + item.name + '.js'
})
})

if (isProd) {
plugins.forEach(item => {
build({
promises.push(build({
input: 'src/plugins/' + item.input,
output: 'plugins/' + item.name + '.min.js',
plugins: [uglify()]
})
}))
})
}

await Promise.all(promises)
}

if (!isProd) {
chokidar
.watch(['src/core', 'src/plugins'], {
atomic: true,
awaitWriteFinish: {
stabilityThreshold: 1000,
pollInterval: 100
}
})
.on('change', p => {
console.log('[watch] ', p)
const dirs = p.split(path.sep)
if (dirs[1] === 'core') {
buildCore()
} else if (dirs[2]) {
const name = path.basename(dirs[2], '.js')
const input = `src/plugins/${name}${
/\.js/.test(dirs[2]) ? '' : '/index'
}.js`
async function main() {
if (!isProd) {
chokidar
.watch(['src/core', 'src/plugins'], {
atomic: true,
awaitWriteFinish: {
stabilityThreshold: 1000,
pollInterval: 100
}
})
.on('change', p => {
console.log('[watch] ', p)
const dirs = p.split(path.sep)
if (dirs[1] === 'core') {
buildCore()
} else if (dirs[2]) {
const name = path.basename(dirs[2], '.js')
const input = `src/plugins/${name}${
/\.js/.test(dirs[2]) ? '' : '/index'
}.js`

build({
input,
output: 'plugins/' + name + '.js'
})
}
})
.on('ready', () => {
console.log('[start]')
buildCore()
build({
input,
output: 'plugins/' + name + '.js'
})
}
})
.on('ready', () => {
console.log('[start]')
buildCore()
buildAllPlugin()
})
} else {
await Promise.all([
buildCore(),
buildAllPlugin()
})
} else {
buildCore()
buildAllPlugin()
])
}
}

main().catch((e) => {
console.error(e)
process.exit(1)
})

14 changes: 10 additions & 4 deletions build/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const {spawn} = require('child_process')
const args = process.argv.slice(2)
fs.readdir(path.join(__dirname, '../src/themes'), (err, files) => {
if (err) {
console.log('err', err)
return
console.error('err', err)
process.exit(1)
}
files.map(async (file) => {
if (/\.styl/g.test(file)) {
Expand All @@ -31,11 +31,17 @@ fs.readdir(path.join(__dirname, '../src/themes'), (err, files) => {
});

stylusCMD.on('close', (code) => {
console.log(`[Stylus Build ] child process exited with code ${code}`);
const message = `[Stylus Build ] child process exited with code ${code}`

if (code !== 0) {
console.error(message);
process.exit(code)
}
console.log(message);
});
} else {
return
}

})
})
})
3 changes: 3 additions & 0 deletions build/mincss.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ files.forEach(file => {
file = path.resolve('lib/themes', file)
cssnano(fs.readFileSync(file)).then(result => {
fs.writeFileSync(file, result.css)
}).catch(e => {
console.error(e)
process.exit(1)
})
})
3 changes: 2 additions & 1 deletion build/ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ rollup
var dest = 'packages/docsify-server-renderer/build.js'

console.log(dest)
bundle.write({
return bundle.write({
format: 'cjs',
file: dest
})
})
.catch(function (err) {
console.error(err)
process.exit(1)
})
2 changes: 1 addition & 1 deletion cypress/fixtures/tpl/docs.index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<meta name="description" content="A magical documentation generator." />
<meta
name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0"
/>
<link rel="stylesheet" href="lib/themes/vue.css" title="vue" />
<link rel="stylesheet" href="lib/themes/dark.css" title="dark" disabled />
Expand Down
6 changes: 6 additions & 0 deletions docs/_media/example-with-yaml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
author: John Smith
date: 2020-1-1
---

> This is from the `example.md`
38 changes: 33 additions & 5 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configuration

You can configure the `window.$docsify`.
You can configure Docsify by defining `window.$docsify` as an object:

```html
<script>
Expand All @@ -12,6 +12,24 @@ You can configure the `window.$docsify`.
</script>
```

The config can also be defined as a function, in which case the first arg is the Docsify `vm` instance. The function should return a config object. This can be useful for referencing `vm` in places like the markdown configuration:

```html
<script>
window.$docsify = function(vm) {
return {
markdown: {
renderer: {
code(code, lang) {
// ... use `vm` ...
},
},
},
};
};
</script>
```

## el

- Type: `String`
Expand Down Expand Up @@ -144,6 +162,16 @@ window.$docsify = {
};
```

If you have a link to the homepage in the sidebar and want it to be shown as active when accessing the root url, make sure to update your sidebar accordingly:

```markdown
- Sidebar
- [Home](/)
- [Another page](another.md)
```

For more details, see [#1131](https://github.com/docsifyjs/docsify/issues/1131).

## basePath

- Type: `String`
Expand Down Expand Up @@ -265,7 +293,7 @@ window.$docsify = {
- Type: `String`
- Default: `window.location.pathname`

The name of the link.
The URL that the website `name` links to.

```js
window.$docsify = {
Expand Down Expand Up @@ -446,11 +474,11 @@ window.$docsify = {
- type: `String`
- default: `noopener`

Default `'noopener'` (no opener) prevents the newly opened external page (when [externalLinkTarget](#externallinktarget) is `'_blank'`) from having the ability to control our page. No `rel` is set when its not `'_blank'`.
Default `'noopener'` (no opener) prevents the newly opened external page (when [externalLinkTarget](#externallinktarget) is `'_blank'`) from having the ability to control our page. No `rel` is set when its not `'_blank'`. See [this post](https://mathiasbynens.github.io/rel-noopener/) for more information about why you may want to use this option.

```js
window.$docsify = {
externalLinkTarget: '', // default: 'noopener'
externalLinkRel: '', // default: 'noopener'
};
```

Expand Down Expand Up @@ -587,4 +615,4 @@ Adds a space on top when scrolling content page to reach the selected section. T
window.$docsify = {
topMargin: 90, // default: 0
};
```
```
14 changes: 13 additions & 1 deletion docs/embed-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,20 @@ You will get it

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

## Markdown with YAML Front Matter

When using Markdown, YAML front matter will be stripped from the rendered content. The attributes cannot be used in this case.

```markdown
[filename](_media/example-with-yaml.md ':include')
```

You will get just the content

[filename](_media/example-with-yaml.md ':include')

## Embedded code fragments

Sometimes you don't want to embed a whole file. Maybe because you need just a few lines but you want to compile and test the file in CI.

```markdown
Expand All @@ -53,7 +66,6 @@ Example:

[filename](_media/example.js ':include :type=code :fragment=demo')


## Tag attribute

If you embed the file as `iframe`, `audio` and `video`, then you may need to set the attributes of these tags.
Expand Down
8 changes: 8 additions & 0 deletions docs/helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set ti
[link](/demo ':disabled')
```

## Cross-Origin link

Only when you both set the `routerMode: 'history'` and `externalLinkTarget: '_self'`, you need add this configuration for those Cross-Origin links.

```md
[example.com](https://example.com/ ':crossorgin')
```

## Github Task Lists

```md
Expand Down
Loading