build: v5 updates and refactors (#2428)

* Update JS build

- Change rollup build from API to config file
- Change output dir from lib to dist
- Update lib to dist path in related files
- Update dependencies
- Add banner comment to bundles
- Add unminified plugin bundles

* Update docs with v5 version lock and dist path

* Update docs to reference minified themes

* Clean up docs

* Update CSS build

- Change CSS build from API to CLI
- Change output dir from lib to dist
- Update lib to dist path in related files
- Update dependencies
- Add sourcemaps

* Update dependencies

* Clean up package.json and add keywords

* Fix rimraf globs on Windows

* Fix PostCSS CLI glob on Windows

* Update test-related dependencies

* Update emoji

* Add engines prop to package.json
This commit is contained in:
John Hildenbiddle 2024-05-21 15:19:21 -05:00 committed by GitHub
parent b9f256d848
commit 4ae87bb18b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
35 changed files with 4450 additions and 4143 deletions

View File

@ -1,8 +1,11 @@
# Directories
.git
**/*.md
build
dist
docs
lib
node_modules
# Files
**/*.md
server.js
themes

23
.gitignore vendored
View File

@ -1,13 +1,16 @@
.DS_Store
# Directories
.husky/_
.idea
*.log
/_playwright-report
/_playwright-results
/lib
/node_modules
/.husky/_
# exceptions
!.gitkeep
.vercel
_playwright-report
_playwright-results
dist
lib
node_modules
# Files
.DS_Store
*.log
# Exceptions
!.gitkeep

View File

@ -1,6 +1,9 @@
# Directories
_playwright-*
dist
lib
# Files
CHANGELOG.md
HISTORY.md
lib/
themes/
_playwright-*/
emoji-data.*
HISTORY.md

View File

@ -3,9 +3,7 @@
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
"targets": "defaults"
}
]
]

View File

@ -1,159 +0,0 @@
import path from 'path';
import { promises as fs } from 'fs';
import * as rollup from 'rollup';
import commonjs from '@rollup/plugin-commonjs';
import nodeResolve from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import terser from '@rollup/plugin-terser';
import chokidar from 'chokidar';
import { relative } from './util.js';
const pkgPath = relative(import.meta, '..', 'package.json');
const pkgString = (await fs.readFile(pkgPath)).toString();
const pkg = JSON.parse(pkgString);
const isProd = process.env.NODE_ENV === 'production';
const version = process.env.VERSION || pkg.version;
/**
* @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 || []),
commonjs(),
nodeResolve(),
replace({
__VERSION__: version,
}),
],
onwarn(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(bundle => {
const dest = 'lib/' + (opts.output || opts.input);
console.log(dest);
return bundle.write({
format: 'iife',
output: opts.globalName ? { name: opts.globalName } : {},
file: dest,
strict: false,
sourcemap: opts.sourcemap,
});
});
}
async function buildCore() {
const promises = [];
promises.push(
build({
input: 'src/core/index.js',
output: 'docsify.js',
})
);
promises.push(
build({
input: 'src/core/index.js',
output: 'docsify.min.js',
plugins: [terser()],
sourcemap: true,
})
);
await Promise.all(promises);
}
async function buildAllPlugin() {
const plugins = [
{ name: 'search', input: 'search/index.js' },
{ name: 'ga', input: 'ga.js' },
{ name: 'gtag', input: 'gtag.js' },
{ name: 'matomo', input: 'matomo.js' },
{ name: 'emoji', input: 'emoji.js' },
{ name: 'external-script', input: 'external-script.js' },
{ name: 'front-matter', input: 'front-matter/index.js' },
{ name: 'zoom-image', input: 'zoom-image.js' },
{ name: 'disqus', input: 'disqus.js' },
{ name: 'gitalk', input: 'gitalk.js' },
];
const promises = plugins.map(item => {
return build({
input: 'src/plugins/' + item.input,
output: 'plugins/' + item.name + '.js',
});
});
plugins.forEach(item => {
promises.push(
build({
input: 'src/plugins/' + item.input,
output: 'plugins/' + item.name + '.min.js',
plugins: [terser()],
sourcemap: true,
})
);
});
await Promise.all(promises);
}
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();
buildAllPlugin();
});
} else {
await Promise.all([buildCore(), buildAllPlugin()]);
}
}
main().catch(e => {
console.error(e);
process.exit(1);
});

View File

@ -1,48 +0,0 @@
import fs from 'fs';
import path from 'path';
import { spawn } from 'child_process';
const relative = path => new URL(path, import.meta.url);
const args = process.argv.slice(2);
fs.readdir(relative('../src/themes'), (err, files) => {
if (err) {
console.error('err', err);
process.exit(1);
}
files.map(async file => {
if (/\.styl/g.test(file)) {
const stylusBin = ['node_modules', 'stylus', 'bin', 'stylus'].join(
path.sep
);
let cmdargs = [
stylusBin,
`src/themes/${file}`,
'-u',
'autoprefixer-stylus',
];
cmdargs = [...cmdargs, ...args];
const stylusCMD = spawn('node', cmdargs, { shell: true });
stylusCMD.stdout.on('data', data => {
console.log(`[Stylus Build ] stdout: ${data}`);
});
stylusCMD.stderr.on('data', data => {
console.error(`[Stylus Build ] stderr: ${data}`);
});
stylusCMD.on('close', 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;
}
});
});

View File

@ -1,21 +0,0 @@
import path from 'path';
import fs from 'fs';
import cssnano from 'cssnano';
const files = fs
.readdirSync(path.resolve('lib/themes'))
.filter(file => !file.endsWith('min.css'));
files.forEach(file => {
file = path.resolve('lib/themes', file);
cssnano
.process(fs.readFileSync(file), { from: file })
.then(result => {
file = file.replace(/\.css$/, '.min.css');
fs.writeFileSync(file, result.css);
})
.catch(e => {
console.error(e);
process.exit(1);
});
});

View File

@ -1,59 +1,56 @@
# CDN
Recommended: [jsDelivr](//cdn.jsdelivr.net), which will reflect the latest version as soon as it is published to npm. You can also browse the source of the npm package at [cdn.jsdelivr.net/npm/docsify/](//cdn.jsdelivr.net/npm/docsify/).
The docsify [npm package](https://www.npmjs.com/package/docsify) is auto-published to CDNs with each release. The contents can be viewed on each CDN.
## Latest version
Docsify recommends [jsDelivr](//cdn.jsdelivr.net) as its preferred CDN:
- https://cdn.jsdelivr.net/npm/docsify/
Other CDNs are available and may be required in locations where jsDelivr is not available:
- https://cdnjs.com/libraries/docsify
- https://unpkg.com/browse/docsify/
- https://www.bootcdn.cn/docsify/
## Specifying versions
Note the `@` version lock in the CDN URLs below. This allows specifying the latest major, minor, patch, or specific [semver](https://semver.org) version number.
- MAJOR versions include breaking changes<br>
`1.0.0``2.0.0`
- MINOR versions include non-breaking new functionality<br>
`1.0.0``1.1.0`
- PATCH versions include non-breaking bug fixes<br>
`1.0.0``1.0.1`
Uncompressed resources are available by omitting the `.min` from the filename.
## Latest "major" version
Specifying the latest major version allows your site to receive all non-breaking enhancements ("minor" updates) and bug fixes ("patch" updates) as they are released. This is good option for those who prefer a zero-maintenance way of keeping their site up to date with minimal risk as new versions are published.
?> When a new major version is released, you will need to manually update the major version number after the `@` symbol in your CDN URLs.
<!-- prettier-ignore -->
```html
<!-- load css -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/vue.css" />
<!-- Theme -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@5/themes/vue.min.css" />
<!-- load script -->
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.js"></script>
<!-- Docsify -->
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/docsify.min.js"></script>
```
Alternatively, use [compressed files](#compressed-file).
## Specific version
Specifying an exact version prevents any future updates from affecting your site. This is good option for those who prefer to manually update their resources as new versions are published.
?> When a new version is released, you will need to manually update the version number after the `@` symbol in your CDN URLs.
<!-- prettier-ignore -->
```html
<!-- load css -->
<link
rel="stylesheet"
href="//cdn.jsdelivr.net/npm/docsify@4.10.2/themes/vue.css"
/>
<!-- Theme -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@5.0.0/themes/vue.min.css" />
<!-- load script -->
<script src="//cdn.jsdelivr.net/npm/docsify@4.10.2/lib/docsify.js"></script>
<!-- Docsify -->
<script src="//cdn.jsdelivr.net/npm/docsify@5.0.0/dist/docsify.min.js"></script>
```
## Compressed file
```html
<!-- load css -->
<link
rel="stylesheet"
href="//cdn.jsdelivr.net/npm/docsify/lib/themes/vue.css"
/>
<!-- load script -->
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
```
```html
<!-- load css -->
<link
rel="stylesheet"
href="//cdn.jsdelivr.net/npm/docsify@4.10.2/lib/themes/vue.css"
/>
<!-- load script -->
<script src="//cdn.jsdelivr.net/npm/docsify@4.10.2/lib/docsify.min.js"></script>
```
## Other CDN
- https://www.bootcdn.cn/docsify/
- https://cdn.jsdelivr.net/npm/docsify/
- https://cdnjs.com/libraries/docsify
- https://unpkg.com/browse/docsify/

View File

@ -14,7 +14,7 @@ Set `coverpage` to **true**, and create a `_coverpage.md`:
coverpage: true,
};
</script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/docsify.min.js"></script>
```
```markdown

View File

@ -30,7 +30,7 @@ Alternatively, you can create a custom markdown-based navigation file by setting
loadNavbar: true,
};
</script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/docsify.min.js"></script>
```
```markdown
@ -82,8 +82,8 @@ If you use the [emoji plugin](plugins#emoji):
// ...
};
</script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/emoji.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/plugins/emoji.min.js"></script>
```
you could, for example, use flag emojis in your custom navbar Markdown file:

View File

@ -262,6 +262,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:beach_umbrella: `:beach_umbrella:`
:beans: `:beans:`
:bear: `:bear:`
:bearded_person: `:bearded_person:`
@ -322,6 +324,10 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:bison: `:bison:`
:biting_lip: `:biting_lip:`
:black_bird: `:black_bird:`
:black_cat: `:black_cat:`
:black_circle: `:black_circle:`
@ -460,6 +466,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:bubble_tea: `:bubble_tea:`
:bubbles: `:bubbles:`
:bucket: `:bucket:`
:bug: `:bug:`
@ -784,6 +792,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:copyright: `:copyright:`
:coral: `:coral:`
:corn: `:corn:`
:costa_rica: `:costa_rica:`
@ -842,6 +852,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:crown: `:crown:`
:crutch: `:crutch:`
:cry: `:cry:`
:crying_cat_face: `:crying_cat_face:`
@ -976,8 +988,12 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:dominican_republic: `:dominican_republic:`
:donkey: `:donkey:`
:door: `:door:`
:dotted_line_face: `:dotted_line_face:`
:doughnut: `:doughnut:`
:dove: `:dove:`
@ -1054,6 +1070,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:email: `:email:`
:empty_nest: `:empty_nest:`
:end: `:end:`
:england: `:england:`
@ -1100,10 +1118,18 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:face_exhaling: `:face_exhaling:`
:face_holding_back_tears: `:face_holding_back_tears:`
:face_in_clouds: `:face_in_clouds:`
:face_with_diagonal_mouth: `:face_with_diagonal_mouth:`
:face_with_head_bandage: `:face_with_head_bandage:`
:face_with_open_eyes_and_hand_over_mouth: `:face_with_open_eyes_and_hand_over_mouth:`
:face_with_peeking_eye: `:face_with_peeking_eye:`
:face_with_spiral_eyes: `:face_with_spiral_eyes:`
:face_with_thermometer: `:face_with_thermometer:`
@ -1280,6 +1306,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:flushed: `:flushed:`
:flute: `:flute:`
:fly: `:fly:`
:flying_disc: `:flying_disc:`
@ -1290,6 +1318,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:foggy: `:foggy:`
:folding_hand_fan: `:folding_hand_fan:`
:fondue: `:fondue:`
:foot: `:foot:`
@ -1386,6 +1416,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:gift_heart: `:gift_heart:`
:ginger_root: `:ginger_root:`
:giraffe: `:giraffe:`
:girl: `:girl:`
@ -1412,6 +1444,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:golfing_woman: `:golfing_woman:`
:goose: `:goose:`
:gorilla: `:gorilla:`
:grapes: `:grapes:`
@ -1436,6 +1470,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:grey_exclamation: `:grey_exclamation:`
:grey_heart: `:grey_heart:`
:grey_question: `:grey_question:`
:grimacing: `:grimacing:`
@ -1470,6 +1506,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:guyana: `:guyana:`
:hair_pick: `:hair_pick:`
:haircut: `:haircut:`
:haircut_man: `:haircut_man:`
@ -1486,12 +1524,16 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:hammer_and_wrench: `:hammer_and_wrench:`
:hamsa: `:hamsa:`
:hamster: `:hamster:`
:hand: `:hand:`
:hand_over_mouth: `:hand_over_mouth:`
:hand_with_index_finger_and_thumb_crossed: `:hand_with_index_finger_and_thumb_crossed:`
:handbag: `:handbag:`
:handball_person: `:handball_person:`
@ -1524,6 +1566,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:heart_eyes_cat: `:heart_eyes_cat:`
:heart_hands: `:heart_hands:`
:heart_on_fire: `:heart_on_fire:`
:heartbeat: `:heartbeat:`
@ -1538,6 +1582,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:heavy_dollar_sign: `:heavy_dollar_sign:`
:heavy_equals_sign: `:heavy_equals_sign:`
:heavy_exclamation_mark: `:heavy_exclamation_mark:`
:heavy_heart_exclamation: `:heavy_heart_exclamation:`
@ -1616,6 +1662,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:hut: `:hut:`
:hyacinth: `:hyacinth:`
:ice_cream: `:ice_cream:`
:ice_cube: `:ice_cube:`
@ -1630,6 +1678,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:id: `:id:`
:identification_card: `:identification_card:`
:ideograph_advantage: `:ideograph_advantage:`
:imp: `:imp:`
@ -1638,6 +1688,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:incoming_envelope: `:incoming_envelope:`
:index_pointing_at_the_viewer: `:index_pointing_at_the_viewer:`
:india: `:india:`
:indonesia: `:indonesia:`
@ -1680,8 +1732,12 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:japanese_ogre: `:japanese_ogre:`
:jar: `:jar:`
:jeans: `:jeans:`
:jellyfish: `:jellyfish:`
:jersey: `:jersey:`
:jigsaw: `:jigsaw:`
@ -1714,6 +1770,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:keycap_ten: `:keycap_ten:`
:khanda: `:khanda:`
:kick_scooter: `:kick_scooter:`
:kimono: `:kimono:`
@ -1804,6 +1862,10 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:leftwards_arrow_with_hook: `:leftwards_arrow_with_hook:`
:leftwards_hand: `:leftwards_hand:`
:leftwards_pushing_hand: `:leftwards_pushing_hand:`
:leg: `:leg:`
:lemon: `:lemon:`
@ -1824,6 +1886,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:liechtenstein: `:liechtenstein:`
:light_blue_heart: `:light_blue_heart:`
:light_rail: `:light_rail:`
:link: `:link:`
@ -1854,6 +1918,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:lotion_bottle: `:lotion_bottle:`
:lotus: `:lotus:`
:lotus_position: `:lotus_position:`
:lotus_position_man: `:lotus_position_man:`
@ -1870,6 +1936,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:love_you_gesture: `:love_you_gesture:`
:low_battery: `:low_battery:`
:low_brightness: `:low_brightness:`
:luggage: `:luggage:`
@ -2006,6 +2074,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:maple_leaf: `:maple_leaf:`
:maracas: `:maracas:`
:marshall_islands: `:marshall_islands:`
:martial_arts_uniform: `:martial_arts_uniform:`
@ -2046,6 +2116,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:melon: `:melon:`
:melting_face: `:melting_face:`
:memo: `:memo:`
:men_wrestling: `:men_wrestling:`
@ -2090,6 +2162,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:mirror: `:mirror:`
:mirror_ball: `:mirror_ball:`
:mobile_phone_off: `:mobile_phone_off:`
:moldova: `:moldova:`
@ -2120,6 +2194,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:moon_cake: `:moon_cake:`
:moose: `:moose:`
:morocco: `:morocco:`
:mortar_board: `:mortar_board:`
@ -2208,6 +2284,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:nerd_face: `:nerd_face:`
:nest_with_eggs: `:nest_with_eggs:`
:nesting_dolls: `:nesting_dolls:`
:netherlands: `:netherlands:`
@ -2402,8 +2480,12 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:palestinian_territories: `:palestinian_territories:`
:palm_down_hand: `:palm_down_hand:`
:palm_tree: `:palm_tree:`
:palm_up_hand: `:palm_up_hand:`
:palms_up_together: `:palms_up_together:`
:panama: `:panama:`
@ -2442,6 +2524,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:paw_prints: `:paw_prints:`
:pea_pod: `:pea_pod:`
:peace_symbol: `:peace_symbol:`
:peach: `:peach:`
@ -2488,6 +2572,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:person_white_hair: `:person_white_hair:`
:person_with_crown: `:person_with_crown:`
:person_with_probing_cane: `:person_with_probing_cane:`
:person_with_turban: `:person_with_turban:`
@ -2528,6 +2614,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:ping_pong: `:ping_pong:`
:pink_heart: `:pink_heart:`
:pirate_flag: `:pirate_flag:`
:pisces: `:pisces:`
@ -2544,6 +2632,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:play_or_pause_button: `:play_or_pause_button:`
:playground_slide: `:playground_slide:`
:pleading_face: `:pleading_face:`
:plunger: `:plunger:`
@ -2596,6 +2686,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:pound: `:pound:`
:pouring_liquid: `:pouring_liquid:`
:pout: `:pout:`
:pouting_cat: `:pouting_cat:`
@ -2610,6 +2702,10 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:prayer_beads: `:prayer_beads:`
:pregnant_man: `:pregnant_man:`
:pregnant_person: `:pregnant_person:`
:pregnant_woman: `:pregnant_woman:`
:pretzel: `:pretzel:`
@ -2756,8 +2852,14 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:right_anger_bubble: `:right_anger_bubble:`
:rightwards_hand: `:rightwards_hand:`
:rightwards_pushing_hand: `:rightwards_pushing_hand:`
:ring: `:ring:`
:ring_buoy: `:ring_buoy:`
:ringed_planet: `:ringed_planet:`
:robot: `:robot:`
@ -2824,6 +2926,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:salt: `:salt:`
:saluting_face: `:saluting_face:`
:samoa: `:samoa:`
:san_marino: `:san_marino:`
@ -2906,6 +3010,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:seychelles: `:seychelles:`
:shaking_face: `:shaking_face:`
:shallow_pan_of_food: `:shallow_pan_of_food:`
:shamrock: `:shamrock:`
@ -3390,6 +3496,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:triumph: `:triumph:`
:troll: `:troll:`
:trolleybus: `:trolleybus:`
:trollface: `:trollface:`
@ -3584,6 +3692,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:whale2: `:whale2:`
:wheel: `:wheel:`
:wheel_of_dharma: `:wheel_of_dharma:`
:wheelchair: `:wheelchair:`
@ -3622,8 +3732,12 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:wine_glass: `:wine_glass:`
:wing: `:wing:`
:wink: `:wink:`
:wireless: `:wireless:`
:wolf: `:wolf:`
:woman: `:woman:`
@ -3718,6 +3832,8 @@ Below is a complete list of emoji shorthand codes. Docsify can be configured to
:x: `:x:`
:x_ray: `:x_ray:`
:yarn: `:yarn:`
:yawning_face: `:yawning_face:`

View File

@ -19,30 +19,30 @@
/>
<link
rel="stylesheet"
href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css"
href="//cdn.jsdelivr.net/npm/docsify@5/dist/themes/vue.min.css"
title="vue"
/>
<link
rel="stylesheet"
href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/dark.css"
href="//cdn.jsdelivr.net/npm/docsify@5/dist/themes/dark.min.css"
title="dark"
disabled
/>
<link
rel="stylesheet"
href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/buble.css"
href="//cdn.jsdelivr.net/npm/docsify@5/dist/themes/buble.min.css"
title="buble"
disabled
/>
<link
rel="stylesheet"
href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/pure.css"
href="//cdn.jsdelivr.net/npm/docsify@5/dist/themes/pure.min.css"
title="pure"
disabled
/>
<link
rel="stylesheet"
href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/dolphin.css"
href="//cdn.jsdelivr.net/npm/docsify@5/dist/themes/dolphin.min.css"
title="dolphin"
disabled
/>
@ -215,11 +215,11 @@
],
};
</script>
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/search.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/front-matter.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/ga.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/matomo.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/plugins/search.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/plugins/front-matter.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/plugins/ga.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/plugins/matomo.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-markdown.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-nginx.min.js"></script>

View File

@ -37,7 +37,7 @@ First, you need to set `loadSidebar` to **true**. Details are available in the [
loadSidebar: true,
};
</script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/docsify.min.js"></script>
```
Create the `_sidebar.md`:
@ -110,7 +110,7 @@ A custom sidebar can also automatically generate a table of contents by setting
subMaxLevel: 2,
};
</script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/docsify.min.js"></script>
```
## Ignoring Subheaders

View File

@ -59,8 +59,8 @@ By default, the hyperlink on the current page is recognized and the content is s
},
};
</script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/plugins/search.min.js"></script>
```
This plugin ignores diacritical marks when performing a full text search (e.g., "cafe" will also match "café").
@ -77,16 +77,16 @@ Install the plugin and configure the track id.
ga: 'UA-XXXXX-Y',
};
</script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/ga.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/plugins/ga.min.js"></script>
```
Configure by `data-ga`.
<!-- prettier-ignore -->
```html
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js" data-ga="UA-XXXXX-Y"></script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/ga.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/docsify.min.js" data-ga="UA-XXXXX-Y"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/plugins/ga.min.js"></script>
```
## Google Analytics 4 (GA4)
@ -110,8 +110,8 @@ Install the plugin and configure the track id.
],
};
</script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/gtag.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/plugins/gtag.min.js"></script>
```
## Emoji
@ -121,7 +121,7 @@ Renders a larger collection of emoji shorthand codes. Without this plugin, Docsi
!> Deprecated as of v4.13. Docsify no longer requires this plugin for full emoji support.
```html
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/emoji.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/plugins/emoji.min.js"></script>
```
## External Script
@ -129,7 +129,7 @@ Renders a larger collection of emoji shorthand codes. Without this plugin, Docsi
If the script on the page is an external one (imports a js file via `src` attribute), you'll need this plugin to make it work.
```html
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/external-script.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/plugins/external-script.min.js"></script>
```
## Zoom image
@ -137,7 +137,7 @@ If the script on the page is an external one (imports a js file via `src` attrib
Medium's image zoom. Based on [medium-zoom](https://github.com/francoischalifour/medium-zoom).
```html
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/zoom-image.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/plugins/zoom-image.min.js"></script>
```
Exclude the special image
@ -178,7 +178,7 @@ Disqus comments. https://disqus.com/
disqus: 'shortname',
};
</script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/disqus.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/plugins/disqus.min.js"></script>
```
## Gitalk
@ -188,7 +188,7 @@ Disqus comments. https://disqus.com/
```html
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/gitalk/dist/gitalk.css" />
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/gitalk.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/plugins/gitalk.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/gitalk/dist/gitalk.min.js"></script>
<script>
const gitalk = new Gitalk({
@ -210,7 +210,7 @@ Disqus comments. https://disqus.com/
Pagination for docsify. By [@imyelo](https://github.com/imyelo)
```html
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify-pagination/dist/docsify-pagination.min.js"></script>
```

View File

@ -38,6 +38,7 @@ docsify serve docs
If you don't like `npm` or have trouble installing the tool, you can manually create `index.html`:
<!-- prettier-ignore -->
```html
<!-- index.html -->
@ -46,10 +47,7 @@ If you don't like `npm` or have trouble installing the tool, you can manually cr
<head>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta charset="UTF-8" />
<link
rel="stylesheet"
href="//cdn.jsdelivr.net/npm/docsify@4/themes/vue.css"
/>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@5/themes/vue.min.css" />
</head>
<body>
<div id="app"></div>
@ -58,41 +56,48 @@ If you don't like `npm` or have trouble installing the tool, you can manually cr
//...
};
</script>
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
<script src="//cdn.jsdelivr.net/npm/docsify@5"></script>
</body>
</html>
```
### Specifying docsify versions
?> 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.
?> 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. `v5.x.x` => `v6.x.x`). Check the docsify website periodically to see if a new major version has been released.
Specifying a major version in the URL (`@4`) will allow your site to 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.
Specifying a major version in the URL (`@5`) will allow your site to 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.
<!-- prettier-ignore -->
```html
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/themes/vue.css" />
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
<!-- Theme -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@5/themes/vue.min.css" />
<!-- Docsify -->
<script src="//cdn.jsdelivr.net/npm/docsify@5"></script>
```
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.
<!-- prettier-ignore -->
```html
<link
rel="stylesheet"
href="//cdn.jsdelivr.net/npm/docsify@4.11.4/themes/vue.css"
/>
<script src="//cdn.jsdelivr.net/npm/docsify@4.11.4"></script>
<!-- Theme -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@5/themes/vue.min.css" />
<!-- Docsify -->
<script src="//cdn.jsdelivr.net/npm/docsify@5"></script>
```
### Manually preview your site
If you have Python installed on your system, you can easily use it to run a static server to preview your site.
```python2
```python
# Python 2
cd docs && python -m SimpleHTTPServer 3000
```
```python3
```python
# Python 3
cd docs && python -m http.server 3000
```

View File

@ -1,67 +1,56 @@
# Themes
There is a handful of themes available, both official and community-made. Copy [Vue](//vuejs.org) and [buble](//buble.surge.sh) website custom theme and [@liril-net](https://github.com/liril-net) contribution to the theme of the black style.
Docsify offers several official themes to choose from. Click a theme name below to preview each theme.
<!-- prettier-ignore-start -->
- <a href="#" data-theme="vue">Vue</a>
- <a href="#" data-theme="buble">Buble</a>
- <a href="#" data-theme="dark">Dark</a>
- <a href="#" data-theme="pure">Pure</a>
- <a href="#" data-theme="dolphin">Dolphin</a>
Official themes are available on multiple [CDNs](cdn). Uncompressed themes are also available by omitting the `.min` from the filename.
<!-- prettier-ignore -->
```html
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/vue.css" />
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/buble.css" />
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/dark.css" />
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/pure.css" />
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/dolphin.css" />
<!-- Vue -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@5/themes/vue.min.css" />
<!-- Buble -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@5/themes/buble.min.css" />
<!-- Dark -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@5/themes/dark.min.css" />
<!-- Pure -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@5/themes/pure.min.css" />
<!-- Dolphin -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@5/themes/dolphin.min.css" />
```
<!-- prettier-ignore-end -->
!> Compressed files are available in `/lib/themes/`.
## Endorsed
<!-- prettier-ignore-start -->
```html
<!-- compressed -->
The Docsify team endorses the following third-party themes. Click a link below the learn more.
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/vue.css" />
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/buble.css" />
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/dark.css" />
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/pure.css" />
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/dolphin.css" />
```
<!-- prettier-ignore-end -->
- [docsify-themeable](https://jhildenbiddle.github.io/docsify-themeable) - A delightfully simple theme system for docsify.
If you have any ideas or would like to develop a new theme, you are welcome to submit a [pull request](https://github.com/docsifyjs/docsify/pulls).
## More Themes
#### Click to preview
<div class="demo-theme-preview">
<a data-theme="vue">vue.css</a>
<a data-theme="buble">buble.css</a>
<a data-theme="dark">dark.css</a>
<a data-theme="pure">pure.css</a>
<a data-theme="dolphin">dolphin.css</a>
</div>
<style>
.demo-theme-preview a {
padding-right: 10px;
}
.demo-theme-preview a:hover {
cursor: pointer;
text-decoration: underline;
}
</style>
See [Awesome Docsify](awesome) for more themes.
<script>
const preview = Docsify.dom.find('.demo-theme-preview');
const themes = Docsify.dom.findAll('[rel="stylesheet"]');
const previewElm = Docsify.dom.findAll('a[data-theme]');
const stylesheetElms = Docsify.dom.findAll('link[rel="stylesheet"]');
preview.onclick = function (e) {
previewElm.forEach(elm => {
elm.onclick = (e) => {
e.preventDefault();
const title = e.target.getAttribute('data-theme');
themes.forEach(theme => {
stylesheetElms.forEach(theme => {
theme.disabled = theme.title !== title;
});
};
});
</script>
## Other themes
- [docsify-themeable](https://jhildenbiddle.github.io/docsify-themeable/#/) A delightfully simple theme system for docsify.

View File

@ -10,7 +10,9 @@ const sharedConfig = {
restoreMocks: true,
setupFilesAfterEnv: ['<rootDir>/test/config/jest.setup-tests.js'],
testEnvironment: 'jsdom',
testURL: `${TEST_HOST}/_blank.html`,
testEnvironmentOptions: {
url: `${TEST_HOST}/_blank.html`,
},
};
process.env.TEST_HOST = TEST_HOST;

View File

@ -17,15 +17,15 @@ export const rewriteRules = [
// Ex2: http://cdn.com/package-name@1.0.0
// Ex3: https://cdn.com/package-name@latest
match: /(?:https?:)*\/\/.*cdn.*docsify[@\d.latest]*(?=["'])/g,
replace: '/lib/docsify.min.js',
replace: '/dist/docsify.min.js',
},
{
// CDN paths to local paths
// Ex1: //cdn.com/package-name/path/file.js => /path/file.js
// Ex2: http://cdn.com/package-name@1.0.0/dist/file.js => /dist/file.js
// Ex3: https://cdn.com/package-name@latest/dist/file.js => /dist/file.js
match: /(?:https?:)*\/\/.*cdn.*docsify[@\d.latest]*\/(?:lib\/)/g,
replace: '/lib/',
match: /(?:https?:)*\/\/.*cdn.*docsify[@\d.latest]*\/(?:dist\/)/g,
replace: '/dist/',
},
];

7443
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,27 +9,85 @@
"collective": {
"url": "https://opencollective.com/docsify"
},
"keywords": [
"client",
"creator",
"crs",
"doc",
"docs",
"documentation",
"generator",
"markdown"
],
"engines": {
"node": ">=20.11.0"
},
"type": "module",
"// The 'main' and 'unpkg' fields will remain as legacy for backwards compatibility for now. We will add deprectaion warnings to these outputs to give people time to see the warnings in their apps in a non-breaking way, and eventually we can remove the legacy stuff.": "",
"main": "lib/docsify.js",
"unpkg": "lib/docsify.min.js",
"// We're using the 'exports' field as an override of the 'main' field to provide the new ESM setup. Once we remove legacy 'main', we will remove the 'exports' field and have a simple ESM setup with only a 'main' field.": "",
"main": "dist/docsify.js",
"exports": {
".": "./src/Docsify.js",
".": "./src/core/Docsify.js",
"./*": "./*"
},
"files": [
"lib",
"dist",
"themes"
],
"lint-staged": {
"*.js": "eslint --fix"
},
"dependencies": {
"marked": "^4.2.12",
"medium-zoom": "^1.1.0",
"opencollective-postinstall": "^2.0.2",
"prismjs": "^1.29.0",
"tinydate": "^1.3.0"
},
"devDependencies": {
"@babel/eslint-parser": "^7.24.5",
"@babel/preset-env": "^7.11.5",
"@eslint/js": "^8.43.0",
"@playwright/test": "^1.44.0",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.2",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-terser": "^0.4.3",
"@types/eslint": "^8.40.2",
"axios": "^1.5.0",
"browser-sync": "^3.0.2",
"common-tags": "^1.8.0",
"conventional-changelog-cli": "^3.0.0",
"cross-env": "^7.0.3",
"cssnano": "^7.0.1",
"eslint": "^8.43.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^28.5.0",
"eslint-plugin-playwright": "^1.6.1",
"eslint-plugin-prettier": "^4.2.1",
"glob": "^10.3.15",
"globals": "^13.20.0",
"husky": "^9.0.11",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^15.2.2",
"npm-run-all": "^4.1.5",
"postcss-cli": "^11.0.0",
"prettier": "^2.8.8",
"rimraf": "^5.0.7",
"rollup": "^4.17.2",
"stylus": "^0.63.0",
"vue": "^3.4.27",
"xhr-mock": "^2.5.1"
},
"scripts": {
"build:cover": "node build/cover.js",
"build:css:min": "node build/mincss.js",
"build:css": "mkdirp lib/themes && node build/css -o lib/themes",
"build:css:min": "postcss \"dist/themes/**/!(*.min).css\" --dir dist/themes --ext .min.css --map --use cssnano",
"build:css": "stylus src/themes --out dist/themes --sourcemap",
"build:emoji": "node ./build/emoji.js",
"build:js": "cross-env NODE_ENV=production node build/build.js",
"build:js": "rollup -c",
"build": "run-s clean build:js build:css build:css:min build:cover build:emoji",
"clean": "rimraf lib themes _playwright*",
"clean": "rimraf --glob dist/** themes/** _playwright*/**",
"dev": "run-p serve:dev watch:*",
"docker:build:test": "npm run docker:cli -- build:test",
"docker:build": "docker build -f Dockerfile -t docsify-test:local .",
@ -56,66 +114,7 @@
"test:jest": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
"test:unit": "npm run test:jest -- --selectProjects unit",
"test": "run-s test:jest test:e2e",
"watch:css": "npm run build:css -- -w",
"watch:js": "node build/build.js"
},
"lint-staged": {
"*.js": "eslint --fix"
},
"dependencies": {
"marked": "^4.2.12",
"medium-zoom": "^1.1.0",
"opencollective-postinstall": "^2.0.2",
"prismjs": "^1.29.0",
"strip-indent": "^3.0.0",
"tinydate": "^1.3.0"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/eslint-parser": "^7.16.5",
"@babel/preset-env": "^7.11.5",
"@eslint/js": "^8.43.0",
"@playwright/test": "^1.44.0",
"@rollup/plugin-commonjs": "^25.0.2",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-terser": "^0.4.3",
"@types/eslint": "^8.40.2",
"autoprefixer-stylus": "^1.0.0",
"axios": "^1.5.0",
"babel-jest": "^27.4.6",
"browser-sync": "^2.26.12",
"chokidar": "^3.4.2",
"common-tags": "^1.8.0",
"conventional-changelog-cli": "^3.0.0",
"copy-dir": "^1.2.0",
"cross-env": "^7.0.3",
"cssnano": "^4.1.10",
"eslint": "^8.43.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.2",
"eslint-plugin-playwright": "^0.16.0",
"eslint-plugin-prettier": "^4.2.1",
"globals": "^13.20.0",
"husky": "^9.0.11",
"jest": "^27.4.7",
"lint-staged": "^13.2.2",
"mkdirp": "^3.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
"rimraf": "^3.0.0",
"rollup": "^3.25.3",
"serve-handler": "^6.1.2",
"stylus": "^0.60.0",
"vue": "^3.4.27",
"xhr-mock": "^2.5.1"
},
"keywords": [
"doc",
"docs",
"documentation",
"creator",
"generator"
]
"watch:css": "run-p 'build:css -- --watch' 'build:css:min -- --watch'",
"watch:js": "npm run build:js -- --watch"
}
}

121
rollup.config.js Normal file
View File

@ -0,0 +1,121 @@
import fs from 'node:fs/promises';
import path from 'node:path';
import { babel } from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import replace from '@rollup/plugin-replace';
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import { glob } from 'glob';
import { stripIndent } from 'common-tags';
// Setup
// =============================================================================
// Docsify
const docsifyConfig = {
inputPath: 'src/core/index.js',
outputDir: 'dist',
outputName: 'docsify',
title: 'Docsify',
};
// Plugins
const pluginPaths = await glob(['src/plugins/*.js', 'src/plugins/*/index.js']);
const pluginConfigs = pluginPaths.map(pluginPath => {
const dir = path.basename(path.dirname(pluginPath)); // path/to/dir/file.js => dir
const name = path.basename(pluginPath, '.js'); // path/to/dir/file.js => file
const outputName = name === 'index' ? dir : name;
return {
inputPath: pluginPath,
outputDir: 'dist/plugins',
outputName,
title: `Docsify Plugin: ${outputName}`,
};
});
// Rollup configurations
// =============================================================================
const currentYear = new Date().getFullYear();
const { homepage, license, version } = JSON.parse(
await fs.readFile(path.join(import.meta.dirname, 'package.json'), 'utf8')
);
const baseConfig = {
output: {
format: 'iife',
},
plugins: [
resolve(),
commonjs(),
replace({
preventAssignment: true,
values: {
__VERSION__: version,
},
}),
babel({
babelHelpers: 'bundled',
}),
],
watch: {
clearScreen: false,
},
};
const bundleConfigs = [];
// Generate rollup configurations
[docsifyConfig, ...pluginConfigs].forEach(bundleConfig => {
const { inputPath, outputDir, outputName, title } = bundleConfig;
// prettier-ignore
const banner = stripIndent`
/*!
* ${title} v${version}
* ${homepage}
* (c) 2017-${currentYear}
* ${license} license
*/
`;
const minifiedConfig = {
...baseConfig,
input: inputPath,
output: {
...baseConfig.output,
banner,
file: path.join(outputDir, `${outputName}.min.js`),
sourcemap: true,
},
plugins: [
...baseConfig.plugins,
terser({
output: {
comments: /^!/,
},
}),
],
};
const unminifiedConfig = {
...baseConfig,
input: inputPath,
output: {
...baseConfig.output,
banner,
file: path.join(outputDir, `${outputName}.js`),
},
plugins: [
...baseConfig.plugins,
terser({
compress: false,
mangle: false,
output: {
beautify: true,
comments: /^!/,
},
}),
],
};
bundleConfigs.push(minifiedConfig, unminifiedConfig);
});
// Exports
// =============================================================================
export default [...bundleConfigs];

View File

@ -21,7 +21,7 @@ export const prodConfig = {
// Development (local URLs, watch enabled)
export const devConfig = {
...prodConfig,
files: ['CHANGELOG.md', 'docs/**/*', 'lib/**/*'],
files: ['CHANGELOG.md', 'docs/**/*', 'dist/**/*'],
port: 3000,
rewriteRules,
reloadDebounce: 1000,
@ -30,7 +30,7 @@ export const devConfig = {
...prodConfig.server,
routes: {
'/changelog.md': path.resolve(__dirname, 'CHANGELOG.md'),
'/lib': path.resolve(__dirname, 'lib'),
'/dist': path.resolve(__dirname, 'dist'),
'/node_modules': path.resolve(__dirname, 'node_modules'), // Required for automated Vue tests
},
},

View File

@ -1,4 +1,4 @@
import stripIndent from 'strip-indent';
import { stripIndent } from 'common-tags';
import { hyphenate, isPrimitive } from './util/core.js';
const currentScript = document.currentScript;

View File

@ -9,7 +9,7 @@ import { get } from './util/ajax.js';
// TODO This is deprecated, kept for backwards compatibility. Remove in a
// major release. We'll tell people to get everything from the DOCSIFY global
// when using the global build, but we'll highly recommend for them to import
// from the ESM build (f.e. lib/docsify.esm.js and lib/docsify.min.esm.js).
// from the ESM build (f.e. dist/docsify.esm.js and dist/docsify.min.esm.js).
export default function initGlobalAPI() {
window.Docsify = {
util,

View File

@ -1,4 +1,4 @@
import stripIndent from 'strip-indent';
import { stripIndent } from 'common-tags';
import { get } from '../util/ajax.js';
const cached = {};

View File

@ -135,6 +135,7 @@ export default {
"bathtub": "unicode/1f6c1.png?v8",
"battery": "unicode/1f50b.png?v8",
"beach_umbrella": "unicode/1f3d6.png?v8",
"beans": "unicode/1fad8.png?v8",
"bear": "unicode/1f43b.png?v8",
"bearded_person": "unicode/1f9d4.png?v8",
"beaver": "unicode/1f9ab.png?v8",
@ -165,6 +166,8 @@ export default {
"bird": "unicode/1f426.png?v8",
"birthday": "unicode/1f382.png?v8",
"bison": "unicode/1f9ac.png?v8",
"biting_lip": "unicode/1fae6.png?v8",
"black_bird": "unicode/1f426-2b1b.png?v8",
"black_cat": "unicode/1f408-2b1b.png?v8",
"black_circle": "unicode/26ab.png?v8",
"black_flag": "unicode/1f3f4.png?v8",
@ -234,6 +237,7 @@ export default {
"brown_square": "unicode/1f7eb.png?v8",
"brunei": "unicode/1f1e7-1f1f3.png?v8",
"bubble_tea": "unicode/1f9cb.png?v8",
"bubbles": "unicode/1fae7.png?v8",
"bucket": "unicode/1faa3.png?v8",
"bug": "unicode/1f41b.png?v8",
"building_construction": "unicode/1f3d7.png?v8",
@ -396,6 +400,7 @@ export default {
"cool": "unicode/1f192.png?v8",
"cop": "unicode/1f46e.png?v8",
"copyright": "unicode/00a9.png?v8",
"coral": "unicode/1fab8.png?v8",
"corn": "unicode/1f33d.png?v8",
"costa_rica": "unicode/1f1e8-1f1f7.png?v8",
"cote_divoire": "unicode/1f1e8-1f1ee.png?v8",
@ -425,6 +430,7 @@ export default {
"crossed_flags": "unicode/1f38c.png?v8",
"crossed_swords": "unicode/2694.png?v8",
"crown": "unicode/1f451.png?v8",
"crutch": "unicode/1fa7c.png?v8",
"cry": "unicode/1f622.png?v8",
"crying_cat_face": "unicode/1f63f.png?v8",
"crystal_ball": "unicode/1f52e.png?v8",
@ -492,7 +498,9 @@ export default {
"dolphin": "unicode/1f42c.png?v8",
"dominica": "unicode/1f1e9-1f1f2.png?v8",
"dominican_republic": "unicode/1f1e9-1f1f4.png?v8",
"donkey": "unicode/1facf.png?v8",
"door": "unicode/1f6aa.png?v8",
"dotted_line_face": "unicode/1fae5.png?v8",
"doughnut": "unicode/1f369.png?v8",
"dove": "unicode/1f54a.png?v8",
"dragon": "unicode/1f409.png?v8",
@ -531,6 +539,7 @@ export default {
"elf_man": "unicode/1f9dd-2642.png?v8",
"elf_woman": "unicode/1f9dd-2640.png?v8",
"email": "unicode/1f4e7.png?v8",
"empty_nest": "unicode/1fab9.png?v8",
"end": "unicode/1f51a.png?v8",
"england": "unicode/1f3f4-e0067-e0062-e0065-e006e-e0067-e007f.png?v8",
"envelope": "unicode/2709.png?v8",
@ -554,8 +563,12 @@ export default {
"eyeglasses": "unicode/1f453.png?v8",
"eyes": "unicode/1f440.png?v8",
"face_exhaling": "unicode/1f62e-1f4a8.png?v8",
"face_holding_back_tears": "unicode/1f979.png?v8",
"face_in_clouds": "unicode/1f636-1f32b.png?v8",
"face_with_diagonal_mouth": "unicode/1fae4.png?v8",
"face_with_head_bandage": "unicode/1f915.png?v8",
"face_with_open_eyes_and_hand_over_mouth": "unicode/1fae2.png?v8",
"face_with_peeking_eye": "unicode/1fae3.png?v8",
"face_with_spiral_eyes": "unicode/1f635-1f4ab.png?v8",
"face_with_thermometer": "unicode/1f912.png?v8",
"facepalm": "unicode/1f926.png?v8",
@ -644,11 +657,13 @@ export default {
"floppy_disk": "unicode/1f4be.png?v8",
"flower_playing_cards": "unicode/1f3b4.png?v8",
"flushed": "unicode/1f633.png?v8",
"flute": "unicode/1fa88.png?v8",
"fly": "unicode/1fab0.png?v8",
"flying_disc": "unicode/1f94f.png?v8",
"flying_saucer": "unicode/1f6f8.png?v8",
"fog": "unicode/1f32b.png?v8",
"foggy": "unicode/1f301.png?v8",
"folding_hand_fan": "unicode/1faad.png?v8",
"fondue": "unicode/1fad5.png?v8",
"foot": "unicode/1f9b6.png?v8",
"football": "unicode/1f3c8.png?v8",
@ -697,6 +712,7 @@ export default {
"gibraltar": "unicode/1f1ec-1f1ee.png?v8",
"gift": "unicode/1f381.png?v8",
"gift_heart": "unicode/1f49d.png?v8",
"ginger_root": "unicode/1fada.png?v8",
"giraffe": "unicode/1f992.png?v8",
"girl": "unicode/1f467.png?v8",
"globe_with_meridians": "unicode/1f310.png?v8",
@ -710,6 +726,7 @@ export default {
"golfing": "unicode/1f3cc.png?v8",
"golfing_man": "unicode/1f3cc-2642.png?v8",
"golfing_woman": "unicode/1f3cc-2640.png?v8",
"goose": "unicode/1fabf.png?v8",
"gorilla": "unicode/1f98d.png?v8",
"grapes": "unicode/1f347.png?v8",
"greece": "unicode/1f1ec-1f1f7.png?v8",
@ -722,6 +739,7 @@ export default {
"greenland": "unicode/1f1ec-1f1f1.png?v8",
"grenada": "unicode/1f1ec-1f1e9.png?v8",
"grey_exclamation": "unicode/2755.png?v8",
"grey_heart": "unicode/1fa76.png?v8",
"grey_question": "unicode/2754.png?v8",
"grimacing": "unicode/1f62c.png?v8",
"grin": "unicode/1f601.png?v8",
@ -739,6 +757,7 @@ export default {
"guitar": "unicode/1f3b8.png?v8",
"gun": "unicode/1f52b.png?v8",
"guyana": "unicode/1f1ec-1f1fe.png?v8",
"hair_pick": "unicode/1faae.png?v8",
"haircut": "unicode/1f487.png?v8",
"haircut_man": "unicode/1f487-2642.png?v8",
"haircut_woman": "unicode/1f487-2640.png?v8",
@ -747,9 +766,11 @@ export default {
"hammer": "unicode/1f528.png?v8",
"hammer_and_pick": "unicode/2692.png?v8",
"hammer_and_wrench": "unicode/1f6e0.png?v8",
"hamsa": "unicode/1faac.png?v8",
"hamster": "unicode/1f439.png?v8",
"hand": "unicode/270b.png?v8",
"hand_over_mouth": "unicode/1f92d.png?v8",
"hand_with_index_finger_and_thumb_crossed": "unicode/1faf0.png?v8",
"handbag": "unicode/1f45c.png?v8",
"handball_person": "unicode/1f93e.png?v8",
"handshake": "unicode/1f91d.png?v8",
@ -766,6 +787,7 @@ export default {
"heart_decoration": "unicode/1f49f.png?v8",
"heart_eyes": "unicode/1f60d.png?v8",
"heart_eyes_cat": "unicode/1f63b.png?v8",
"heart_hands": "unicode/1faf6.png?v8",
"heart_on_fire": "unicode/2764-1f525.png?v8",
"heartbeat": "unicode/1f493.png?v8",
"heartpulse": "unicode/1f497.png?v8",
@ -773,6 +795,7 @@ export default {
"heavy_check_mark": "unicode/2714.png?v8",
"heavy_division_sign": "unicode/2797.png?v8",
"heavy_dollar_sign": "unicode/1f4b2.png?v8",
"heavy_equals_sign": "unicode/1f7f0.png?v8",
"heavy_exclamation_mark": "unicode/2757.png?v8",
"heavy_heart_exclamation": "unicode/2763.png?v8",
"heavy_minus_sign": "unicode/2796.png?v8",
@ -812,6 +835,7 @@ export default {
"hurtrealbad": "hurtrealbad.png?v8",
"hushed": "unicode/1f62f.png?v8",
"hut": "unicode/1f6d6.png?v8",
"hyacinth": "unicode/1fabb.png?v8",
"ice_cream": "unicode/1f368.png?v8",
"ice_cube": "unicode/1f9ca.png?v8",
"ice_hockey": "unicode/1f3d2.png?v8",
@ -819,10 +843,12 @@ export default {
"icecream": "unicode/1f366.png?v8",
"iceland": "unicode/1f1ee-1f1f8.png?v8",
"id": "unicode/1f194.png?v8",
"identification_card": "unicode/1faaa.png?v8",
"ideograph_advantage": "unicode/1f250.png?v8",
"imp": "unicode/1f47f.png?v8",
"inbox_tray": "unicode/1f4e5.png?v8",
"incoming_envelope": "unicode/1f4e8.png?v8",
"index_pointing_at_the_viewer": "unicode/1faf5.png?v8",
"india": "unicode/1f1ee-1f1f3.png?v8",
"indonesia": "unicode/1f1ee-1f1e9.png?v8",
"infinity": "unicode/267e.png?v8",
@ -844,7 +870,9 @@ export default {
"japanese_castle": "unicode/1f3ef.png?v8",
"japanese_goblin": "unicode/1f47a.png?v8",
"japanese_ogre": "unicode/1f479.png?v8",
"jar": "unicode/1fad9.png?v8",
"jeans": "unicode/1f456.png?v8",
"jellyfish": "unicode/1fabc.png?v8",
"jersey": "unicode/1f1ef-1f1ea.png?v8",
"jigsaw": "unicode/1f9e9.png?v8",
"jordan": "unicode/1f1ef-1f1f4.png?v8",
@ -861,6 +889,7 @@ export default {
"key": "unicode/1f511.png?v8",
"keyboard": "unicode/2328.png?v8",
"keycap_ten": "unicode/1f51f.png?v8",
"khanda": "unicode/1faaf.png?v8",
"kick_scooter": "unicode/1f6f4.png?v8",
"kimono": "unicode/1f458.png?v8",
"kiribati": "unicode/1f1f0-1f1ee.png?v8",
@ -906,6 +935,8 @@ export default {
"left_right_arrow": "unicode/2194.png?v8",
"left_speech_bubble": "unicode/1f5e8.png?v8",
"leftwards_arrow_with_hook": "unicode/21a9.png?v8",
"leftwards_hand": "unicode/1faf2.png?v8",
"leftwards_pushing_hand": "unicode/1faf7.png?v8",
"leg": "unicode/1f9b5.png?v8",
"lemon": "unicode/1f34b.png?v8",
"leo": "unicode/264c.png?v8",
@ -916,6 +947,7 @@ export default {
"libra": "unicode/264e.png?v8",
"libya": "unicode/1f1f1-1f1fe.png?v8",
"liechtenstein": "unicode/1f1f1-1f1ee.png?v8",
"light_blue_heart": "unicode/1fa75.png?v8",
"light_rail": "unicode/1f688.png?v8",
"link": "unicode/1f517.png?v8",
"lion": "unicode/1f981.png?v8",
@ -931,6 +963,7 @@ export default {
"long_drum": "unicode/1fa98.png?v8",
"loop": "unicode/27bf.png?v8",
"lotion_bottle": "unicode/1f9f4.png?v8",
"lotus": "unicode/1fab7.png?v8",
"lotus_position": "unicode/1f9d8.png?v8",
"lotus_position_man": "unicode/1f9d8-2642.png?v8",
"lotus_position_woman": "unicode/1f9d8-2640.png?v8",
@ -939,6 +972,7 @@ export default {
"love_hotel": "unicode/1f3e9.png?v8",
"love_letter": "unicode/1f48c.png?v8",
"love_you_gesture": "unicode/1f91f.png?v8",
"low_battery": "unicode/1faab.png?v8",
"low_brightness": "unicode/1f505.png?v8",
"luggage": "unicode/1f9f3.png?v8",
"lungs": "unicode/1fac1.png?v8",
@ -1007,6 +1041,7 @@ export default {
"mantelpiece_clock": "unicode/1f570.png?v8",
"manual_wheelchair": "unicode/1f9bd.png?v8",
"maple_leaf": "unicode/1f341.png?v8",
"maracas": "unicode/1fa87.png?v8",
"marshall_islands": "unicode/1f1f2-1f1ed.png?v8",
"martial_arts_uniform": "unicode/1f94b.png?v8",
"martinique": "unicode/1f1f2-1f1f6.png?v8",
@ -1027,6 +1062,7 @@ export default {
"medical_symbol": "unicode/2695.png?v8",
"mega": "unicode/1f4e3.png?v8",
"melon": "unicode/1f348.png?v8",
"melting_face": "unicode/1fae0.png?v8",
"memo": "unicode/1f4dd.png?v8",
"men_wrestling": "unicode/1f93c-2642.png?v8",
"mending_heart": "unicode/2764-1fa79.png?v8",
@ -1049,6 +1085,7 @@ export default {
"minibus": "unicode/1f690.png?v8",
"minidisc": "unicode/1f4bd.png?v8",
"mirror": "unicode/1fa9e.png?v8",
"mirror_ball": "unicode/1faa9.png?v8",
"mobile_phone_off": "unicode/1f4f4.png?v8",
"moldova": "unicode/1f1f2-1f1e9.png?v8",
"monaco": "unicode/1f1f2-1f1e8.png?v8",
@ -1064,6 +1101,7 @@ export default {
"montserrat": "unicode/1f1f2-1f1f8.png?v8",
"moon": "unicode/1f314.png?v8",
"moon_cake": "unicode/1f96e.png?v8",
"moose": "unicode/1face.png?v8",
"morocco": "unicode/1f1f2-1f1e6.png?v8",
"mortar_board": "unicode/1f393.png?v8",
"mosque": "unicode/1f54c.png?v8",
@ -1108,6 +1146,7 @@ export default {
"negative_squared_cross_mark": "unicode/274e.png?v8",
"nepal": "unicode/1f1f3-1f1f5.png?v8",
"nerd_face": "unicode/1f913.png?v8",
"nest_with_eggs": "unicode/1faba.png?v8",
"nesting_dolls": "unicode/1fa86.png?v8",
"netherlands": "unicode/1f1f3-1f1f1.png?v8",
"neutral_face": "unicode/1f610.png?v8",
@ -1205,7 +1244,9 @@ export default {
"pakistan": "unicode/1f1f5-1f1f0.png?v8",
"palau": "unicode/1f1f5-1f1fc.png?v8",
"palestinian_territories": "unicode/1f1f5-1f1f8.png?v8",
"palm_down_hand": "unicode/1faf3.png?v8",
"palm_tree": "unicode/1f334.png?v8",
"palm_up_hand": "unicode/1faf4.png?v8",
"palms_up_together": "unicode/1f932.png?v8",
"panama": "unicode/1f1f5-1f1e6.png?v8",
"pancakes": "unicode/1f95e.png?v8",
@ -1225,6 +1266,7 @@ export default {
"passport_control": "unicode/1f6c2.png?v8",
"pause_button": "unicode/23f8.png?v8",
"paw_prints": "unicode/1f43e.png?v8",
"pea_pod": "unicode/1fadb.png?v8",
"peace_symbol": "unicode/262e.png?v8",
"peach": "unicode/1f351.png?v8",
"peacock": "unicode/1f99a.png?v8",
@ -1248,6 +1290,7 @@ export default {
"person_in_tuxedo": "unicode/1f935.png?v8",
"person_red_hair": "unicode/1f9d1-1f9b0.png?v8",
"person_white_hair": "unicode/1f9d1-1f9b3.png?v8",
"person_with_crown": "unicode/1fac5.png?v8",
"person_with_probing_cane": "unicode/1f9d1-1f9af.png?v8",
"person_with_turban": "unicode/1f473.png?v8",
"person_with_veil": "unicode/1f470.png?v8",
@ -1268,6 +1311,7 @@ export default {
"pinching_hand": "unicode/1f90f.png?v8",
"pineapple": "unicode/1f34d.png?v8",
"ping_pong": "unicode/1f3d3.png?v8",
"pink_heart": "unicode/1fa77.png?v8",
"pirate_flag": "unicode/1f3f4-2620.png?v8",
"pisces": "unicode/2653.png?v8",
"pitcairn_islands": "unicode/1f1f5-1f1f3.png?v8",
@ -1276,6 +1320,7 @@ export default {
"place_of_worship": "unicode/1f6d0.png?v8",
"plate_with_cutlery": "unicode/1f37d.png?v8",
"play_or_pause_button": "unicode/23ef.png?v8",
"playground_slide": "unicode/1f6dd.png?v8",
"pleading_face": "unicode/1f97a.png?v8",
"plunger": "unicode/1faa0.png?v8",
"point_down": "unicode/1f447.png?v8",
@ -1302,6 +1347,7 @@ export default {
"pouch": "unicode/1f45d.png?v8",
"poultry_leg": "unicode/1f357.png?v8",
"pound": "unicode/1f4b7.png?v8",
"pouring_liquid": "unicode/1fad7.png?v8",
"pout": "unicode/1f621.png?v8",
"pouting_cat": "unicode/1f63e.png?v8",
"pouting_face": "unicode/1f64e.png?v8",
@ -1309,6 +1355,8 @@ export default {
"pouting_woman": "unicode/1f64e-2640.png?v8",
"pray": "unicode/1f64f.png?v8",
"prayer_beads": "unicode/1f4ff.png?v8",
"pregnant_man": "unicode/1fac3.png?v8",
"pregnant_person": "unicode/1fac4.png?v8",
"pregnant_woman": "unicode/1f930.png?v8",
"pretzel": "unicode/1f968.png?v8",
"previous_track_button": "unicode/23ee.png?v8",
@ -1382,7 +1430,10 @@ export default {
"rice_cracker": "unicode/1f358.png?v8",
"rice_scene": "unicode/1f391.png?v8",
"right_anger_bubble": "unicode/1f5ef.png?v8",
"rightwards_hand": "unicode/1faf1.png?v8",
"rightwards_pushing_hand": "unicode/1faf8.png?v8",
"ring": "unicode/1f48d.png?v8",
"ring_buoy": "unicode/1f6df.png?v8",
"ringed_planet": "unicode/1fa90.png?v8",
"robot": "unicode/1f916.png?v8",
"rock": "unicode/1faa8.png?v8",
@ -1416,6 +1467,7 @@ export default {
"sailboat": "unicode/26f5.png?v8",
"sake": "unicode/1f376.png?v8",
"salt": "unicode/1f9c2.png?v8",
"saluting_face": "unicode/1fae1.png?v8",
"samoa": "unicode/1f1fc-1f1f8.png?v8",
"san_marino": "unicode/1f1f8-1f1f2.png?v8",
"sandal": "unicode/1f461.png?v8",
@ -1457,6 +1509,7 @@ export default {
"seven": "unicode/0037-20e3.png?v8",
"sewing_needle": "unicode/1faa1.png?v8",
"seychelles": "unicode/1f1f8-1f1e8.png?v8",
"shaking_face": "unicode/1fae8.png?v8",
"shallow_pan_of_food": "unicode/1f958.png?v8",
"shamrock": "unicode/2618.png?v8",
"shark": "unicode/1f988.png?v8",
@ -1699,6 +1752,7 @@ export default {
"trinidad_tobago": "unicode/1f1f9-1f1f9.png?v8",
"tristan_da_cunha": "unicode/1f1f9-1f1e6.png?v8",
"triumph": "unicode/1f624.png?v8",
"troll": "unicode/1f9cc.png?v8",
"trolleybus": "unicode/1f68e.png?v8",
"trollface": "trollface.png?v8",
"trophy": "unicode/1f3c6.png?v8",
@ -1796,6 +1850,7 @@ export default {
"western_sahara": "unicode/1f1ea-1f1ed.png?v8",
"whale": "unicode/1f433.png?v8",
"whale2": "unicode/1f40b.png?v8",
"wheel": "unicode/1f6de.png?v8",
"wheel_of_dharma": "unicode/2638.png?v8",
"wheelchair": "unicode/267f.png?v8",
"white_check_mark": "unicode/2705.png?v8",
@ -1815,7 +1870,9 @@ export default {
"wind_face": "unicode/1f32c.png?v8",
"window": "unicode/1fa9f.png?v8",
"wine_glass": "unicode/1f377.png?v8",
"wing": "unicode/1fabd.png?v8",
"wink": "unicode/1f609.png?v8",
"wireless": "unicode/1f6dc.png?v8",
"wolf": "unicode/1f43a.png?v8",
"woman": "unicode/1f469.png?v8",
"woman_artist": "unicode/1f469-1f3a8.png?v8",
@ -1863,6 +1920,7 @@ export default {
"wrestling": "unicode/1f93c.png?v8",
"writing_hand": "unicode/270d.png?v8",
"x": "unicode/274c.png?v8",
"x_ray": "unicode/1fa7b.png?v8",
"yarn": "unicode/1f9f6.png?v8",
"yawning_face": "unicode/1f971.png?v8",
"yellow_circle": "unicode/1f7e1.png?v8",

View File

@ -15,10 +15,10 @@ test.describe('Creating a Docsify site (e2e tests in Playwright)', () => {
});
// Inject docsify theme (vue.css)
await page.addStyleTag({ url: '/lib/themes/vue.css' });
await page.addStyleTag({ url: '/dist/themes/vue.css' });
// Inject docsify.js
await page.addScriptTag({ url: '/lib/docsify.js' });
await page.addScriptTag({ url: '/dist/docsify.js' });
// Wait for docsify to initialize
await page.waitForSelector('#main');
@ -89,14 +89,14 @@ test.describe('Creating a Docsify site (e2e tests in Playwright)', () => {
// docsifyInit() route
'data-test-scripturls.js',
// Server route
'/lib/plugins/search.min.js',
'/dist/plugins/search.js',
],
style: `
body {
background: red !important;
}
`,
styleURLs: ['/lib/themes/vue.css'],
styleURLs: ['/dist/themes/vue.css'],
};
await docsifyInit({
@ -208,7 +208,7 @@ test.describe('Creating a Docsify site (e2e tests in Playwright)', () => {
// upon billions upon billions upon billions upon billions.
// `,
// },
// styleURLs: [`/lib/themes/vue.css`],
// styleURLs: [`/dist/themes/vue.css`],
// // _logHTML: true,
// });

View File

@ -37,8 +37,8 @@ test.describe('Gtag Plugin Tests', () => {
config: {
gtag: gtagList[0],
},
scriptURLs: ['/lib/plugins/gtag.min.js'],
styleURLs: ['/lib/themes/vue.css'],
scriptURLs: ['/dist/plugins/gtag.js'],
styleURLs: ['/dist/themes/vue.css'],
};
await docsifyInit({
@ -63,8 +63,8 @@ test.describe('Gtag Plugin Tests', () => {
config: {
gtag: gtagList,
},
scriptURLs: ['/lib/plugins/gtag.min.js'],
styleURLs: ['/lib/themes/vue.css'],
scriptURLs: ['/dist/plugins/gtag.js'],
styleURLs: ['/dist/themes/vue.css'],
};
await docsifyInit({

View File

@ -21,7 +21,7 @@ test.describe('Search Plugin Tests', () => {
This is a custom route.
`,
},
scriptURLs: ['/lib/plugins/search.min.js'],
scriptURLs: ['/dist/plugins/search.js'],
};
const searchFieldElm = page.locator('input[type=search]');
@ -64,7 +64,7 @@ test.describe('Search Plugin Tests', () => {
There're three places to populate your docs for your Github repository2.
`,
},
scriptURLs: ['/lib/plugins/search.min.js'],
scriptURLs: ['/dist/plugins/search.js'],
};
const searchFieldElm = page.locator('input[type=search]');
@ -99,7 +99,7 @@ test.describe('Search Plugin Tests', () => {
This is a custom route.
`,
},
scriptURLs: ['/lib/plugins/search.js'],
scriptURLs: ['/dist/plugins/search.js'],
};
const searchFieldElm = page.locator('input[type=search]');
@ -125,7 +125,7 @@ test.describe('Search Plugin Tests', () => {
docsify genera su sitio web de documentación sobre la marcha. A diferencia de GitBook, no genera archivos estáticos html. En cambio, carga y analiza de forma inteligente sus archivos de Markdown y los muestra como sitio web. Todo lo que necesita hacer es crear un index.html para comenzar y desplegarlo en GitHub Pages.
`,
},
scriptURLs: ['/lib/plugins/search.min.js'],
scriptURLs: ['/dist/plugins/search.js'],
};
const searchFieldElm = page.locator('input[type=search]');
@ -159,7 +159,7 @@ test.describe('Search Plugin Tests', () => {
hello, this is a changelog
`,
},
scriptURLs: ['/lib/plugins/search.min.js'],
scriptURLs: ['/dist/plugins/search.js'],
};
const searchFieldElm = page.locator('input[type=search]');
@ -186,7 +186,7 @@ test.describe('Search Plugin Tests', () => {
---
`,
},
scriptURLs: ['/lib/plugins/search.min.js'],
scriptURLs: ['/dist/plugins/search.js'],
};
const searchFieldElm = page.locator('input[type=search]');
@ -200,7 +200,7 @@ test.describe('Search Plugin Tests', () => {
test('handles default focusSearch binding', async ({ page }) => {
const docsifyInitConfig = {
scriptURLs: ['/lib/plugins/search.min.js'],
scriptURLs: ['/dist/plugins/search.js'],
};
const searchFieldElm = page.locator('input[type="search"]');
@ -219,7 +219,7 @@ test.describe('Search Plugin Tests', () => {
keyBindings: ['z'],
},
},
scriptURLs: ['/lib/plugins/search.min.js'],
scriptURLs: ['/dist/plugins/search.js'],
};
const searchFieldElm = page.locator('input[type="search"]');

View File

@ -1,4 +1,4 @@
import stripIndent from 'common-tags/lib/stripIndent/index.js';
import { stripIndent } from 'common-tags';
import docsifyInit from '../helpers/docsify-init.js';
import { test, expect } from './fixtures/docsify-init-fixture.js';

View File

@ -3,12 +3,12 @@ import _mock, { proxy } from 'xhr-mock';
import axios from 'axios';
import prettier from 'prettier';
import stripIndent from 'common-tags/lib/stripIndent/index.js';
import { stripIndent } from 'common-tags';
import { waitForSelector } from './wait-for.js';
const mock = _mock.default;
const docsifyPATH = '../../lib/docsify.js'; // JSDOM
const docsifyURL = '/lib/docsify.js'; // Playwright
const docsifyPATH = '../../dist/docsify.js'; // JSDOM
const docsifyURL = '/dist/docsify.js'; // Playwright
/**
* Jest / Playwright helper for creating custom docsify test sites
@ -25,7 +25,7 @@ const docsifyURL = '/lib/docsify.js'; // Playwright
* @param {String} [options.script] JS to inject via <script> tag
* @param {String|String[]} [options.scriptURLs] External JS to inject via <script src="..."> tag(s)
* @param {String} [options.style] CSS to inject via <style> tag
* @param {String|String[]} [options.styleURLs=['/lib/themes/vue.css']] External CSS to inject via <link rel="stylesheet"> tag(s)
* @param {String|String[]} [options.styleURLs=['/dist/themes/vue.css']] External CSS to inject via <link rel="stylesheet"> tag(s)
* @param {String} [options.testURL] URL to set as window.location.href
* @param {String} [options.waitForSelector='#main'] Element to wait for before returning promise
* @param {Boolean|Object|String} [options._logHTML] Logs HTML to console after initialization. Accepts CSS selector.

View File

@ -1,26 +1,26 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Docs Site coverpage renders and is unchanged 1`] = `
"<section class=\\"cover show\\" role=\\"complementary\\" aria-label=\\"cover\\" style=\\"background:
"<section class="cover show" role="complementary" aria-label="cover" style="background:
linear-gradient(
to left bottom,
hsl(127, 100%, 85%) 0%,
hsl(127, 100%, 85%) 100%
)
\\">
<div class=\\"mask\\"></div>
<div class=\\"cover-main\\"><p><img src=\\"http://127.0.0.1:4000/_media/icon.svg\\" data-origin=\\"_media/icon.svg\\" alt=\\"logo\\"></p><h1 id=\\"docsify-4130\\" tabindex=\\"-1\\"><a href=\\"#/?id=docsify-4130\\" data-id=\\"docsify-4130\\" class=\\"anchor\\"><span>docsify <small>4.13.0</small></span></a></h1><blockquote>
">
<div class="mask"></div>
<div class="cover-main"><p><img src="http://127.0.0.1:4000/_media/icon.svg" data-origin="_media/icon.svg" alt="logo"></p><h1 id="docsify-4130" tabindex="-1"><a href="#/?id=docsify-4130" data-id="docsify-4130" class="anchor"><span>docsify <small>4.13.0</small></span></a></h1><blockquote>
<p>A magical documentation site generator.</p></blockquote>
<ul><li>Simple and lightweight</li><li>No statically built html files</li><li>Multiple themes</li></ul><p><a href=\\"https://github.com/docsifyjs/docsify/\\" target=\\"_blank\\" rel=\\"noopener\\">GitHub</a>
<a href=\\"#/?id=docsify\\">Getting Started</a></p></div>
<ul><li>Simple and lightweight</li><li>No statically built html files</li><li>Multiple themes</li></ul><p><a href="https://github.com/docsifyjs/docsify/" target="_blank" rel="noopener">GitHub</a>
<a href="#/?id=docsify">Getting Started</a></p></div>
</section>"
`;
exports[`Docs Site navbar renders and is unchanged 1`] = `"<nav aria-label=\\"secondary\\" class=\\"app-nav no-badge\\"><ul><li>Translations<ul><li><a href=\\"#/\\"><img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f1ec-1f1e7.png?v8.png\\" alt=\\"uk\\" class=\\"emoji\\" loading=\\"lazy\\"> English</a></li><li><a href=\\"#/zh-cn/\\"><img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f1e8-1f1f3.png?v8.png\\" alt=\\"cn\\" class=\\"emoji\\" loading=\\"lazy\\"> 简体中文</a></li><li><a href=\\"#/de-de/\\"><img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f1e9-1f1ea.png?v8.png\\" alt=\\"de\\" class=\\"emoji\\" loading=\\"lazy\\"> Deutsch</a></li><li><a href=\\"#/es/\\"><img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f1ea-1f1f8.png?v8.png\\" alt=\\"es\\" class=\\"emoji\\" loading=\\"lazy\\"> Español</a></li><li><a href=\\"#/ru-ru/\\"><img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f1f7-1f1fa.png?v8.png\\" alt=\\"ru\\" class=\\"emoji\\" loading=\\"lazy\\"> Русский</a></li></ul></li></ul></nav>"`;
exports[`Docs Site navbar renders and is unchanged 1`] = `"<nav aria-label="secondary" class="app-nav no-badge"><ul><li>Translations<ul><li><a href="#/"><img src="https://github.githubassets.com/images/icons/emoji/unicode/1f1ec-1f1e7.png?v8.png" alt="uk" class="emoji" loading="lazy"> English</a></li><li><a href="#/zh-cn/"><img src="https://github.githubassets.com/images/icons/emoji/unicode/1f1e8-1f1f3.png?v8.png" alt="cn" class="emoji" loading="lazy"> 简体中文</a></li><li><a href="#/de-de/"><img src="https://github.githubassets.com/images/icons/emoji/unicode/1f1e9-1f1ea.png?v8.png" alt="de" class="emoji" loading="lazy"> Deutsch</a></li><li><a href="#/es/"><img src="https://github.githubassets.com/images/icons/emoji/unicode/1f1ea-1f1f8.png?v8.png" alt="es" class="emoji" loading="lazy"> Español</a></li><li><a href="#/ru-ru/"><img src="https://github.githubassets.com/images/icons/emoji/unicode/1f1f7-1f1fa.png?v8.png" alt="ru" class="emoji" loading="lazy"> Русский</a></li></ul></li></ul></nav>"`;
exports[`Docs Site sidebar renders and is unchanged 1`] = `
"<aside id=\\"__sidebar\\" class=\\"sidebar\\" role=\\"none\\">
"<aside id="__sidebar" class="sidebar" role="none">
<div class=\\"sidebar-nav\\" role=\\"navigation\\" aria-label=\\"primary\\"><ul><li><p>Getting started</p><ul><li><a href=\\"#/quickstart\\">Quick start</a></li><li><a href=\\"#/more-pages\\">Writing more pages</a></li><li><a href=\\"#/custom-navbar\\">Custom navbar</a></li><li><a href=\\"#/cover\\">Cover page</a></li></ul></li><li><p>Customization</p><ul><li><a href=\\"#/configuration\\">Configuration</a></li><li><a href=\\"#/themes\\">Themes</a></li><li><a href=\\"#/plugins\\">List of Plugins</a></li><li><a href=\\"#/write-a-plugin\\">Write a Plugin</a></li><li><a href=\\"#/markdown\\">Markdown configuration</a></li><li><a href=\\"#/language-highlight\\">Language highlighting</a></li><li><a href=\\"#/emoji\\">Emoji</a></li></ul></li><li><p>Guide</p><ul><li><a href=\\"#/deploy\\">Deploy</a></li><li><a href=\\"#/helpers\\">Helpers</a></li><li><a href=\\"#/vue\\">Vue compatibility</a></li><li><a href=\\"#/cdn\\">CDN</a></li><li><a href=\\"#/pwa\\">Offline Mode (PWA)</a></li><li><a href=\\"#/embed-files\\">Embed Files</a></li></ul></li><li><p><a href=\\"#/awesome\\">Awesome docsify</a></p></li><li><p><a href=\\"#/changelog\\">Changelog</a></p></li></ul></div>
<div class="sidebar-nav" role="navigation" aria-label="primary"><ul><li><p>Getting started</p><ul><li><a href="#/quickstart">Quick start</a></li><li><a href="#/more-pages">Writing more pages</a></li><li><a href="#/custom-navbar">Custom navbar</a></li><li><a href="#/cover">Cover page</a></li></ul></li><li><p>Customization</p><ul><li><a href="#/configuration">Configuration</a></li><li><a href="#/themes">Themes</a></li><li><a href="#/plugins">List of Plugins</a></li><li><a href="#/write-a-plugin">Write a Plugin</a></li><li><a href="#/markdown">Markdown configuration</a></li><li><a href="#/language-highlight">Language highlighting</a></li><li><a href="#/emoji">Emoji</a></li></ul></li><li><p>Guide</p><ul><li><a href="#/deploy">Deploy</a></li><li><a href="#/helpers">Helpers</a></li><li><a href="#/vue">Vue compatibility</a></li><li><a href="#/cdn">CDN</a></li><li><a href="#/pwa">Offline Mode (PWA)</a></li><li><a href="#/embed-files">Embed Files</a></li></ul></li><li><p><a href="#/awesome">Awesome docsify</a></p></li><li><p><a href="#/changelog">Changelog</a></p></li></ul></div>
</aside>"
`;

View File

@ -2,9 +2,9 @@
exports[`Emoji Ignores all emoji shorthand codes (noEmoji:true) 1`] = `"<p>:smile:</p><p>:smile::smile:</p><p>:smile: :smile:</p><p>:smile::smile::smile:</p><p>:smile: :smile: :smile:</p><p>text:smile:</p><p>:smile:text</p><p>text:smile:text</p>"`;
exports[`Emoji Ignores emoji shorthand codes in URIs 1`] = `"<p>Url <a href=\\"https://docsify.js.org/:foo:/\\" target=\\"_blank\\" rel=\\"noopener\\">https://docsify.js.org/:foo:/</a> <a href=\\"http://docsify.js.org/:100:/\\" target=\\"_blank\\" rel=\\"noopener\\">http://docsify.js.org/:100:/</a> <a href=\\"ftp://docsify.js.org/:smile:/\\" target=\\"_blank\\" rel=\\"noopener\\">ftp://docsify.js.org/:smile:/</a></p>"`;
exports[`Emoji Ignores emoji shorthand codes in URIs 1`] = `"<p>Url <a href="https://docsify.js.org/:foo:/" target="_blank" rel="noopener">https://docsify.js.org/:foo:/</a> <a href="http://docsify.js.org/:100:/" target="_blank" rel="noopener">http://docsify.js.org/:100:/</a> <a href="ftp://docsify.js.org/:smile:/" target="_blank" rel="noopener">ftp://docsify.js.org/:smile:/</a></p>"`;
exports[`Emoji Ignores emoji shorthand codes in URIs while handling anchor content 1`] = `"<p>Achor tags <a href=\\"http://docsify.js.org/:100:/\\" target=\\"_blank\\" rel=\\"noopener\\"><img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f4af.png?v8.png\\" alt=\\"100\\" class=\\"emoji\\" loading=\\"lazy\\"></a></p>"`;
exports[`Emoji Ignores emoji shorthand codes in URIs while handling anchor content 1`] = `"<p>Achor tags <a href="http://docsify.js.org/:100:/" target="_blank" rel="noopener"><img src="https://github.githubassets.com/images/icons/emoji/unicode/1f4af.png?v8.png" alt="100" class="emoji" loading="lazy"></a></p>"`;
exports[`Emoji Ignores emoji shorthand codes in code, pre, script, and template tags 1`] = `
"<pre>:100:</pre>
@ -20,12 +20,12 @@ exports[`Emoji Ignores emoji shorthand codes in code, pre, script, and template
exports[`Emoji Ignores emoji shorthand codes in comments 1`] = `"<p>Text <!-- :foo: :100: --></p>"`;
exports[`Emoji Ignores emoji shorthand codes in html attributes 1`] = `"<p><a href=\\"http://domain.com/:smile:/\\"> <img src=\\"http://domain.com/:smile:/file.png\\"> <script src=\\"http://domain.com/:smile:/file.js\\"></script></a></p>"`;
exports[`Emoji Ignores emoji shorthand codes in html attributes 1`] = `"<p><a href="http://domain.com/:smile:/"> <img src="http://domain.com/:smile:/file.png"> <script src="http://domain.com/:smile:/file.js"></script></a></p>"`;
exports[`Emoji Ignores emoji shorthand codes in style url() values 1`] = `"<style>@import url(http://domain.com/:smile/file.css);</style>"`;
exports[`Emoji Ignores unmatched emoji shorthand codes 1`] = `"<p>hh:mm</p><p>hh:mm:ss</p><p>Namespace::SubNameSpace</p><p>Namespace::SubNameSpace::Class</p><p>2014-12-29T16:11:20+00:00</p>"`;
exports[`Emoji Renders GitHub emoji images (nativeEmoji:false) 1`] = `"<p><img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png\\" alt=\\"smile\\" class=\\"emoji\\" loading=\\"lazy\\"></p><p><img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png\\" alt=\\"smile\\" class=\\"emoji\\" loading=\\"lazy\\"><img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png\\" alt=\\"smile\\" class=\\"emoji\\" loading=\\"lazy\\"></p><p><img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png\\" alt=\\"smile\\" class=\\"emoji\\" loading=\\"lazy\\"> <img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png\\" alt=\\"smile\\" class=\\"emoji\\" loading=\\"lazy\\"></p><p><img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png\\" alt=\\"smile\\" class=\\"emoji\\" loading=\\"lazy\\"><img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png\\" alt=\\"smile\\" class=\\"emoji\\" loading=\\"lazy\\"><img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png\\" alt=\\"smile\\" class=\\"emoji\\" loading=\\"lazy\\"></p><p><img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png\\" alt=\\"smile\\" class=\\"emoji\\" loading=\\"lazy\\"> <img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png\\" alt=\\"smile\\" class=\\"emoji\\" loading=\\"lazy\\"> <img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png\\" alt=\\"smile\\" class=\\"emoji\\" loading=\\"lazy\\"></p><p>text<img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png\\" alt=\\"smile\\" class=\\"emoji\\" loading=\\"lazy\\"></p><p><img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png\\" alt=\\"smile\\" class=\\"emoji\\" loading=\\"lazy\\">text</p><p>text<img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png\\" alt=\\"smile\\" class=\\"emoji\\" loading=\\"lazy\\">text</p>"`;
exports[`Emoji Renders GitHub emoji images (nativeEmoji:false) 1`] = `"<p><img src="https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png" alt="smile" class="emoji" loading="lazy"></p><p><img src="https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png" alt="smile" class="emoji" loading="lazy"><img src="https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png" alt="smile" class="emoji" loading="lazy"></p><p><img src="https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png" alt="smile" class="emoji" loading="lazy"> <img src="https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png" alt="smile" class="emoji" loading="lazy"></p><p><img src="https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png" alt="smile" class="emoji" loading="lazy"><img src="https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png" alt="smile" class="emoji" loading="lazy"><img src="https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png" alt="smile" class="emoji" loading="lazy"></p><p><img src="https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png" alt="smile" class="emoji" loading="lazy"> <img src="https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png" alt="smile" class="emoji" loading="lazy"> <img src="https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png" alt="smile" class="emoji" loading="lazy"></p><p>text<img src="https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png" alt="smile" class="emoji" loading="lazy"></p><p><img src="https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png" alt="smile" class="emoji" loading="lazy">text</p><p>text<img src="https://github.githubassets.com/images/icons/emoji/unicode/1f604.png?v8.png" alt="smile" class="emoji" loading="lazy">text</p>"`;
exports[`Emoji Renders native emoji characters (nativeEmoji:true) 1`] = `"<p><span class=\\"emoji\\">😄︎</span></p><p><span class=\\"emoji\\">😄︎</span><span class=\\"emoji\\">😄︎</span></p><p><span class=\\"emoji\\">😄︎</span> <span class=\\"emoji\\">😄︎</span></p><p><span class=\\"emoji\\">😄︎</span><span class=\\"emoji\\">😄︎</span><span class=\\"emoji\\">😄︎</span></p><p><span class=\\"emoji\\">😄︎</span> <span class=\\"emoji\\">😄︎</span> <span class=\\"emoji\\">😄︎</span></p><p>text<span class=\\"emoji\\">😄︎</span></p><p><span class=\\"emoji\\">😄︎</span>text</p><p>text<span class=\\"emoji\\">😄︎</span>text</p>"`;
exports[`Emoji Renders native emoji characters (nativeEmoji:true) 1`] = `"<p><span class="emoji">😄︎</span></p><p><span class="emoji">😄︎</span><span class="emoji">😄︎</span></p><p><span class="emoji">😄︎</span> <span class="emoji">😄︎</span></p><p><span class="emoji">😄︎</span><span class="emoji">😄︎</span><span class="emoji">😄︎</span></p><p><span class="emoji">😄︎</span> <span class="emoji">😄︎</span> <span class="emoji">😄︎</span></p><p>text<span class="emoji">😄︎</span></p><p><span class="emoji">😄︎</span>text</p><p>text<span class="emoji">😄︎</span>text</p>"`;

View File

@ -59,14 +59,14 @@ describe('Creating a Docsify site (integration tests in Jest)', function () {
// docsifyInit() route
'data-test-scripturls.js',
// Server route
'/lib/plugins/search.min.js',
'/dist/plugins/search.js',
],
style: `
body {
background: red !important;
}
`,
styleURLs: ['/lib/themes/vue.css'],
styleURLs: ['/dist/themes/vue.css'],
};
await docsifyInit({

View File

@ -1,4 +1,4 @@
import stripIndent from 'common-tags/lib/stripIndent/index.js';
import { stripIndent } from 'common-tags';
import docsifyInit from '../helpers/docsify-init.js';
import { waitForText } from '../helpers/wait-for.js';
@ -16,16 +16,14 @@ describe('render', function () {
const output = window.marked('!> Important content');
expect(output).toMatchInlineSnapshot(
`"<p class=\\"tip\\">Important content</p>"`
`"<p class="tip">Important content</p>"`
);
});
test('general tip', () => {
const output = window.marked('?> General tip');
expect(output).toMatchInlineSnapshot(
`"<p class=\\"warn\\">General tip</p>"`
);
expect(output).toMatchInlineSnapshot(`"<p class="warn">General tip</p>"`);
});
});
@ -44,7 +42,7 @@ describe('render', function () {
`);
expect(output).toMatchInlineSnapshot(
`"<ul class=\\"task-list\\"><li class=\\"task-list-item\\"><label><input checked=\\"\\" disabled=\\"\\" type=\\"checkbox\\"> Task 1</label></li><li class=\\"task-list-item\\"><label><input disabled=\\"\\" type=\\"checkbox\\"> Task 2</label></li><li class=\\"task-list-item\\"><label><input disabled=\\"\\" type=\\"checkbox\\"> Task 3</label></li></ul>"`
`"<ul class="task-list"><li class="task-list-item"><label><input checked="" disabled="" type="checkbox"> Task 1</label></li><li class="task-list-item"><label><input disabled="" type="checkbox"> Task 2</label></li><li class="task-list-item"><label><input disabled="" type="checkbox"> Task 3</label></li></ul>"`
);
});
@ -55,7 +53,7 @@ describe('render', function () {
`);
expect(output).toMatchInlineSnapshot(
`"<ol class=\\"task-list\\"><li class=\\"task-list-item\\"><label><input disabled=\\"\\" type=\\"checkbox\\"> Task 1</label></li><li class=\\"task-list-item\\"><label><input checked=\\"\\" disabled=\\"\\" type=\\"checkbox\\"> Task 2</label></li></ol>"`
`"<ol class="task-list"><li class="task-list-item"><label><input disabled="" type="checkbox"> Task 1</label></li><li class="task-list-item"><label><input checked="" disabled="" type="checkbox"> Task 2</label></li></ol>"`
);
});
@ -66,7 +64,7 @@ describe('render', function () {
`);
expect(output).toMatchInlineSnapshot(
`"<ul ><li><a href=\\"#/link\\" >linktext</a></li><li>just text</li></ul>"`
`"<ul ><li><a href="#/link" >linktext</a></li><li>just text</li></ul>"`
);
});
@ -81,7 +79,7 @@ describe('render', function () {
`);
expect(output).toMatchInlineSnapshot(
`"<ol ><li>first</li><li>second</li></ol><p>text</p><ol start=\\"3\\"><li>third</li></ol>"`
`"<ol ><li>first</li><li>second</li></ol><p>text</p><ol start="3"><li>third</li></ol>"`
);
});
@ -111,7 +109,7 @@ describe('render', function () {
const output = window.marked('![alt text](http://imageUrl)');
expect(output).toMatchInlineSnapshot(
`"<p><img src=\\"http://imageUrl\\" data-origin=\\"http://imageUrl\\" alt=\\"alt text\\" /></p>"`
`"<p><img src="http://imageUrl" data-origin="http://imageUrl" alt="alt text" /></p>"`
);
});
@ -121,7 +119,7 @@ describe('render', function () {
);
expect(output).toMatchInlineSnapshot(
`"<p><img src=\\"http://imageUrl\\" data-origin=\\"http://imageUrl\\" alt=\\"alt text\\" class=\\"someCssClass\\" /></p>"`
`"<p><img src="http://imageUrl" data-origin="http://imageUrl" alt="alt text" class="someCssClass" /></p>"`
);
});
@ -131,7 +129,7 @@ describe('render', function () {
);
expect(output).toMatchInlineSnapshot(
`"<p><img src=\\"http://imageUrl\\" data-origin=\\"http://imageUrl\\" alt=\\"alt text\\" id=\\"someCssID\\" /></p>"`
`"<p><img src="http://imageUrl" data-origin="http://imageUrl" alt="alt text" id="someCssID" /></p>"`
);
});
@ -139,7 +137,7 @@ describe('render', function () {
const output = window.marked("![alt text](http://imageUrl ':no-zoom')");
expect(output).toMatchInlineSnapshot(
`"<p><img src=\\"http://imageUrl\\" data-origin=\\"http://imageUrl\\" alt=\\"alt text\\" data-no-zoom /></p>"`
`"<p><img src="http://imageUrl" data-origin="http://imageUrl" alt="alt text" data-no-zoom /></p>"`
);
});
@ -149,7 +147,7 @@ describe('render', function () {
);
expect(output).toMatchInlineSnapshot(
`"<p><img src=\\"http://imageUrl\\" data-origin=\\"http://imageUrl\\" alt=\\"alt text\\" width=\\"WIDTH\\" height=\\"HEIGHT\\" /></p>"`
`"<p><img src="http://imageUrl" data-origin="http://imageUrl" alt="alt text" width="WIDTH" height="HEIGHT" /></p>"`
);
});
@ -157,7 +155,7 @@ describe('render', function () {
const output = window.marked("![alt text](http://imageUrl ':size=50')");
expect(output).toMatchInlineSnapshot(
`"<p><img src=\\"http://imageUrl\\" data-origin=\\"http://imageUrl\\" alt=\\"alt text\\" width=\\"50\\" /></p>"`
`"<p><img src="http://imageUrl" data-origin="http://imageUrl" alt="alt text" width="50" /></p>"`
);
});
});
@ -173,7 +171,7 @@ describe('render', function () {
const output = window.marked('# h1 tag');
expect(output).toMatchInlineSnapshot(
`"<h1 id=\\"h1-tag\\" tabindex=\\"-1\\"><a href=\\"#/?id=h1-tag\\" data-id=\\"h1-tag\\" class=\\"anchor\\"><span>h1 tag</span></a></h1>"`
`"<h1 id="h1-tag" tabindex="-1"><a href="#/?id=h1-tag" data-id="h1-tag" class="anchor"><span>h1 tag</span></a></h1>"`
);
});
@ -181,7 +179,7 @@ describe('render', function () {
const output = window.marked('## h2 tag');
expect(output).toMatchInlineSnapshot(
`"<h2 id=\\"h2-tag\\" tabindex=\\"-1\\"><a href=\\"#/?id=h2-tag\\" data-id=\\"h2-tag\\" class=\\"anchor\\"><span>h2 tag</span></a></h2>"`
`"<h2 id="h2-tag" tabindex="-1"><a href="#/?id=h2-tag" data-id="h2-tag" class="anchor"><span>h2 tag</span></a></h2>"`
);
});
@ -189,7 +187,7 @@ describe('render', function () {
const output = window.marked('### h3 tag');
expect(output).toMatchInlineSnapshot(
`"<h3 id=\\"h3-tag\\" tabindex=\\"-1\\"><a href=\\"#/?id=h3-tag\\" data-id=\\"h3-tag\\" class=\\"anchor\\"><span>h3 tag</span></a></h3>"`
`"<h3 id="h3-tag" tabindex="-1"><a href="#/?id=h3-tag" data-id="h3-tag" class="anchor"><span>h3 tag</span></a></h3>"`
);
});
@ -197,7 +195,7 @@ describe('render', function () {
const output = window.marked('#### h4 tag');
expect(output).toMatchInlineSnapshot(
`"<h4 id=\\"h4-tag\\" tabindex=\\"-1\\"><a href=\\"#/?id=h4-tag\\" data-id=\\"h4-tag\\" class=\\"anchor\\"><span>h4 tag</span></a></h4>"`
`"<h4 id="h4-tag" tabindex="-1"><a href="#/?id=h4-tag" data-id="h4-tag" class="anchor"><span>h4 tag</span></a></h4>"`
);
});
@ -205,7 +203,7 @@ describe('render', function () {
const output = window.marked('##### h5 tag');
expect(output).toMatchInlineSnapshot(
`"<h5 id=\\"h5-tag\\" tabindex=\\"-1\\"><a href=\\"#/?id=h5-tag\\" data-id=\\"h5-tag\\" class=\\"anchor\\"><span>h5 tag</span></a></h5>"`
`"<h5 id="h5-tag" tabindex="-1"><a href="#/?id=h5-tag" data-id="h5-tag" class="anchor"><span>h5 tag</span></a></h5>"`
);
});
@ -213,7 +211,7 @@ describe('render', function () {
const output = window.marked('###### h6 tag');
expect(output).toMatchInlineSnapshot(
`"<h6 id=\\"h6-tag\\" tabindex=\\"-1\\"><a href=\\"#/?id=h6-tag\\" data-id=\\"h6-tag\\" class=\\"anchor\\"><span>h6 tag</span></a></h6>"`
`"<h6 id="h6-tag" tabindex="-1"><a href="#/?id=h6-tag" data-id="h6-tag" class="anchor"><span>h6 tag</span></a></h6>"`
);
});
});
@ -229,7 +227,7 @@ describe('render', function () {
const output = window.marked('[alt text](http://url)');
expect(output).toMatchInlineSnapshot(
`"<p><a href=\\"http://url\\" target=\\"_blank\\" rel=\\"noopener\\">alt text</a></p>"`
`"<p><a href="http://url" target="_blank" rel="noopener">alt text</a></p>"`
);
});
@ -241,7 +239,7 @@ describe('render', function () {
const output = window.marked('[alt text](http://www.example.com)');
expect(output).toMatchInlineSnapshot(
`"<p><a href=\\"http://www.example.com\\" target=\\"_blank\\" rel=\\"noopener\\">alt text</a></p>"`
`"<p><a href="http://www.example.com" target="_blank" rel="noopener">alt text</a></p>"`
);
});
@ -249,7 +247,7 @@ describe('render', function () {
const output = window.marked("[alt text](http://url ':disabled')");
expect(output).toMatchInlineSnapshot(
`"<p><a href=\\"javascript:void(0)\\" target=\\"_blank\\" rel=\\"noopener\\" disabled>alt text</a></p>"`
`"<p><a href="javascript:void(0)" target="_blank" rel="noopener" disabled>alt text</a></p>"`
);
});
@ -257,7 +255,7 @@ describe('render', function () {
const output = window.marked("[alt text](http://url ':target=_self')");
expect(output).toMatchInlineSnapshot(
`"<p><a href=\\"http://url\\" target=\\"_self\\" >alt text</a></p>"`
`"<p><a href="http://url" target="_self" >alt text</a></p>"`
);
});
@ -265,7 +263,7 @@ describe('render', function () {
const output = window.marked("[alt text](/url ':target=_blank')");
expect(output).toMatchInlineSnapshot(
`"<p><a href=\\"#/url\\" target=\\"_blank\\">alt text</a></p>"`
`"<p><a href="#/url" target="_blank">alt text</a></p>"`
);
});
@ -275,7 +273,7 @@ describe('render', function () {
);
expect(output).toMatchInlineSnapshot(
`"<p><a href=\\"http://url\\" target=\\"_blank\\" rel=\\"noopener\\" class=\\"someCssClass\\">alt text</a></p>"`
`"<p><a href="http://url" target="_blank" rel="noopener" class="someCssClass">alt text</a></p>"`
);
});
@ -283,7 +281,7 @@ describe('render', function () {
const output = window.marked("[alt text](http://url ':id=someCssID')");
expect(output).toMatchInlineSnapshot(
`"<p><a href=\\"http://url\\" target=\\"_blank\\" rel=\\"noopener\\" id=\\"someCssID\\">alt text</a></p>"`
`"<p><a href="http://url" target="_blank" rel="noopener" id="someCssID">alt text</a></p>"`
);
});
});
@ -299,7 +297,7 @@ describe('render', function () {
expect(elm.textContent).toBe(expectText);
expect(elm.outerHTML).toMatchInlineSnapshot(
`"<button id=\\"skip-to-content\\">Skip to main content</button>"`
`"<button id="skip-to-content">Skip to main content</button>"`
);
});