84 Commits

Author SHA1 Message Date
Joe Pea
5e0f68caf0 convert Docsify and mixins to ES classes 2021-12-07 18:23:06 -08:00
John Hildenbiddle
a0f61b2af7
fix: Replace ES6 usage for IE11 compatibility (#1500)
* Remove ES6 syntax for IE11 compatibility

* Replace unsupported methods (IE11)
2021-02-08 23:42:31 -06:00
John Hildenbiddle
06cbebfc0d
fix: Use legacy-compatible methods for IE11 (#1495) 2021-02-07 10:44:18 -06:00
John Hildenbiddle
14ce7f3d86
fix: Prevent loading remote content via URL hash (#1489)
* Prevent loading remote content via URL hash

Fixes #1477. Fixes #1126.

* Restore ability to execute remote content scripts

Co-authored-by: 沈唁 <52o@qq52o.cn>
Co-authored-by: Koy <koy@ko8e24.top>
2021-02-05 13:56:28 +08:00
John Hildenbiddle
9a1935ac64 Add support for Vue shorthand directive syntax 2020-11-15 13:34:03 -06:00
John Hildenbiddle
727ee8fc6d Rename vueMountOptions to vueMounts 2020-11-11 16:24:50 -06:00
John Hildenbiddle
6a5e84bf3c Update directive detection (data vs static) 2020-10-23 13:12:56 -05:00
John Hildenbiddle
86dae610de Rename vueOptions to vueMountOptions 2020-10-21 13:14:07 -05:00
John Hildenbiddle
8a56f7241f Fix directive detection 2020-10-18 18:35:24 -05:00
John Hildenbiddle
6d152e2bec Refactor regular expression usage 2020-10-17 01:46:41 -05:00
John Hildenbiddle
bc2e091937 Ignore el property in Vue configs for Vue v2 2020-10-16 00:06:42 -05:00
John Hildenbiddle
a2386e5a59 Add vueComponents support 2020-10-15 23:25:02 -05:00
John Hildenbiddle
5fa79ebcdb Fix Vue content detection and global options
- Add detection of Vue HTML directives to trigger mounting
- Fix bug that processed markdown child nodes as global Vue instances even if vueGlobalOptions is not specified
- Fix bug that prevented passing vueGlobalOptions to global instances if `data()` prop did not exist
- Update Vue config check to test for existence of object keys instead of just the existence object
- Update tests
2020-10-14 19:11:54 -05:00
John Hildenbiddle
cd8f2d3efc Fix vueGlobalOptions.data checks 2020-10-10 01:45:02 -05:00
John Hildenbiddle
35ad5c559b Add vueOptions and vueGlobalOptions
Fixed #752
2020-10-09 23:14:57 -05:00
John Hildenbiddle
0afbf96701
Fix eslint warnings (#1388) 2020-10-08 21:58:30 -05:00
John Hildenbiddle
b135f8417d Add Vue 3 compatibility
- Update docs
- Update tests
- Add Vue 2 to docs site
- Add Vue 2 & 3 dependencies for tests
2020-10-07 13:13:03 -05:00
John Hildenbiddle
78c2a9d7b8 Merge remote-tracking branch 'origin/develop' into fix-790
# Conflicts:
#	cypress/fixtures/tpl/docs.index.html
#	cypress/integration/sidebar/config.spec.js
#	docs/index.html
#	index.html
2020-10-05 14:52:41 -05:00
John Hildenbiddle
7f0c42eda5
Jest + Playwright Testing (#1276)
* Initial Jest+Playwright setup

* Fix eslint warnings

* Add placeholder for common options

* Fix load order of scriptURLs

* Add docsifyURL and waitForSelector options

* Add executeScript scenarios

* Enable firefox and webkit tests by default

* Prevent prettier from reformatting browsers list

* Update options and add JSDoc comments

* Initial commit

* Complete initial example tests

* Minor tweaks

* Change suite name

* Rename file

* Add npm script to run jest+playwright example test

* Clean up server properties

* Isolate e2e, integration, and unit test environments

- Setup projects for e2e, integration, and unit tests in Jest configuration
- Setup /tests/e2e/ tests for Jest+PlayWright
- Setup /tests/integration/ tests for Jest
- Setup /tests/unit/ tests for Jest
- Setup eslint for Jest and Jest+Playwright environments
- Move e2e configuration files into separate folder
- Update e2e example tests
- Update unit example tests
- Update HTML fixtures

* Update docsifyInit helper

- Add `debug` option
- Append `Markdown` suffix to markdown-related options
- Reorder options alphabetically

* Add jestPlaywright.debug() to e2e examples

* Removed need to pass page as arg to docsifyInit()

* Add VSCode debug configurations

* Change test server port from 8080 to 3001

* Clean up test names and expect() order

* Update npm scripts to ignore example tests

* Add CLI commands and resources section

* Add Jest unit test snapshot example

* Added Jest unit and e2e tests to Github workflows

* Add npm script to run Jest examples

Added for new devs who are exploring the examples, as the need for passing --testPathIgnorePatterns is not obvious. This flag is required because the example tests are excluded by default.

* Remove node 10.x and add 14.x from tests

Required for jest+playwright testitng

* Temporarily disable testPathIgnorePatterns for ci

* Temporarily remove node 14 from matrix

Cypress fails on node 14.x

* Alternate workflow setup for new test env

* Update workflow platforms and node versions

Also cleaning up naming

* Restoring original workflow names

* Remove Cypress tests

* Remove/Reset GitHub actions

* Restore/reset workflows

* Bump actions/checkout@v1 to v2

* Use playright GH action

* Update playwright GH action configuration

* Remove unnecessary steps and update checkout version

* Add install step

* Add --ignore-scripts flag

Linting does not require running scripts automatically executred after install.

* Swicth from ci to i for install

* Add new Build & Test workflow

* Add OS tests

* Wait for network idle for more reliable ready state

* Configure image snapshot testing and add example

* Remove example fixture file

* Adjust image snapshot threshold for local & CI tests

* Upload diff-output artifact

* Add failure() check to upload-artifact

* Bump image snapshot threshold for local & CI tests

* Set diffDirection

* Fix XHR caching in playwright tests

* Update image snapshot example and theshold

* Bump image snapshot threshold for local & CI tests

* Remove old workflows

* Bump image snapshot threshold for local & CI tests

* Bump image snapshot failureThreshold for local & CI tests

* Set failureThresholdType to percent

* Change image snapshot comparisonMethod to ssim

* Remove pixelMatch options (incompatible with ssim)

* Bump image snapshot failureThreshold

* Bump image snapshot failureThreshold

* Disable fast-fail to allow all checks to complete

* Rename workflow

* Disable fast-fail to allow all checks to complete

* Store pixel and ssim comparison configs

* Add link to image snapshot test

* Fix CI errors on Windows due to image size mismatch

* Attempt to fix macos e2e exit code 134 issue

* Update test.yml

* Update test.yml

* Update test.yml

* Fix --ci flag

* Set Jets to use --runInBand for macOS e2e

* Remove unnecessary macOS check

* Set image snapshot to runInProcess (macOS CI fix)

* Update test.yml

* Temporary failureThreshold change for debugging

* Upload os+node-specific diff artifacts

* Remove node version from diff artifact

* Revert "Remove node version from diff artifact"

This reverts commit 9cfcc4342bb22f18da30363a4c52758f13ba0cc9.

* Revert "Revert "Remove node version from diff artifact""

This reverts commit ad6c1891e48c70c9973a5c0d7b876b2d4621f3b9.

* Restoring failureThreshold after debugging

* Remove runInProcess option

* Revert "Remove runInProcess option"

This reverts commit 667ed6c870fc56f0349fc5eccc2cdeead3eff4ea.

* Add node-specific artifact uploads

* Set ssim mode to fast and restore runInProcess

* Set failureThreshold to 0.01

* Updating to playwright@next for webkit fix

* Restore optimal ssim configuration

* Testing pixel vs. ssim image comparison

* Move shared test setup to unit/int/e2e setups

* Refactor test server setup

* Replace live-server with browser-sync

* Update script for running local docs site

- Only init GA plugin on public site
- Only init Gitter plugin on public site
- Only init Matomo plugin on public site

NOTE: Large diff is a result of initial Prettier formatting. Actual change limited to last <script> block on page.

* Allow launching test server preview with --start

* Add integration tests and refactor unit + e2e

* Unify docsifyInit() and cleanup

- Create unified docsifyInit() for jest and playwright
- Move shared helpers to /tests/helpers
- Update tests
- Update globals

* Fixed webkit routes by specifying ContentType

* Update snapshot

* Update dependencies

* Update tests to use unified docsifyInit()

* Remove Cypress (old e2e test environment)

* Update tests to run (unit/integration/e2e)

- Add new integration tests (Jest)
- Remove old unit tests (mocha+jsdom)
- Remove old e2e tests (Cypress)

* Remove Cypress-related dependency

* Remove mocha+chai+jsdom (old unit/int test env)

* Rename testing directories and scripts

- Rename /tests/ directory to /test/
- Rename script/task names by removing “jest” identifier
- Remove “test:jest-examples” script

* - Configure test server for availability with all tests (previously e2e only)
- Create identical docsifyInit() tests using Jest (integration) and Playwright (e2e)
- Update docsifyInit() to convert relative URLs to absolute URLs to work in both JSDOM and Playwright
- Update docsifyInit() to append style- and js-related tags using createElement instead of insertAdjacentHTML
- Update paths in test files to use unified docsifyInit()
- Added option to docsifyInit() to enable/disable formatted HTML output to console
- Removed vue.css as default docsify theme from docsifyInit()
- Removed outdated files

* Reorganize test files

* Fix basePath option

* Replace do-mock-ajax with xhr-mock

- Allows mocking all XMLHttpRequests instead of just those initiated via /src/core/fetch/ajax.js
- Allows JSDOM tests to use /lib/docsify.js instead of /src/core/index.js (same as Playwright tests)
- Allows JSDOM tests to use /docs site as test content

* Added new waitFor helpers

* Clean up globals

- Import globals from various files instead of manually adding them to ensure they are availability in Jest and eslint configurations
- Add middleware to server configuration for serving virtual “_blank.html” file
- Add BLANK_URL
- Rename TEST_URL to TEST_HOST
- Removed ./test/fixtures/ directory (blank page now served via server.js middleware)
- Added page.goto(BLANK_URL) call to global Playwright beforeEach() setup

* Add try/catch for waitForFunction callback

* Move playwright config into jest.config.js

* Add runInBand option to tests for reliability

* Remove unnecessary XHR Mock teardown

* Add —runInBand to test script

* Merge develop

* Cleanup

- Relocate carbon plugin script with other scripts
- Update zh-cn docs URL to align with other translatins (GitHub, not jsdelivr)
- Add major version locks to URLs

* Removed fixed host value from docs

* Updated test after merge (docsify version change)

* Added startPath for manual instance

* Remove Node 10 from CI tests

* Remove Node 10 from CI lint tests
2020-10-05 14:10:30 -05:00
John Hildenbiddle
105fbbf692 Updates per request
- When Vue.js is detected, markdown `<script>` is not executed when executeScript is `false` (matches previous behavior)
- Minor code tweaks that do not affect functonality
2020-07-05 20:15:06 -05:00
John Hildenbiddle
f385e21a1b Fix Vue compatibility (fix #790)
- Fix inability to instantiate reactive Vue components by 1) handling each child of #main instead of #main itself and 2)  skipping elements that are already Vue instances
- Retain previous behavior of processing basic Vue rendering without the need for a markdown <script> tag.
- Update documentation and add live Vue examples
- Update `index.html` files to include Vue.js and Vuep (CSS+JS)
2020-07-05 03:15:20 -05:00
Anix
714ef29afe
feat: added html sanitizer for remote rendering (#1128)
Co-authored-by: Joe Pea <joe@trusktr.io>
2020-06-17 23:55:59 +05:30
Anix
3d662a5bf7 fix: fixed target and rel issue (fixes #1183) 2020-05-20 11:14:26 +00:00
Anix
9afa66607d chore: removed circular dep and css.escape 2020-03-09 20:33:07 +05:30
Máté Solymosi
0f1749cb66
chore(scroll): smarter scroll behavior (#744)
authored-by: Mate Solymosi <mate.solymosi.ext@siemens.com>
2020-03-09 14:23:08 +05:30
Leonardo Rossi
b53ea1e304
Adds option to specify an header height (#1045)
* Adds option to specify an header height

When using a template that has a sticky-header, clicking on the sidebar will
scroll the page under the header.

I added the option `headerHeight` (default = `0`) so that the content div will
be scrolled down that amount of pixels.

* updates documentation and renames variable
2020-03-09 14:19:31 +05:30
Anix
b7547f151e
feat: new option hideSidebar (#1026)
* feat: new option hideSidebar

* chore: removed the console logs

* chore: linting fixes

* chore: test fix
2020-02-20 22:19:31 +05:30
Anix
75c72e917b
chore: added new linter config (#1028)
* chore: added new linter config

* chore: linting fixes

* chore: refactore in linting config and minor linting fixes
2020-02-20 14:01:04 +05:30
cyrilf
2928eb7e55
Ensure autoHeader dom result is similar to parsed H1 (#811) 2020-02-04 22:34:44 +05:30
Giulio Ambrogi
db97a1d22a Eslint fixes for v4x (#989)
* UPDATE .eslintrc

* UPDATE lint task

* FIX lint errors

* CLEANUP

* FIX no-eq-null warning

* FIX many jsdoc warnings

* FIX jsdoc issues

* FIX jsdoc warnings

* FIX jsdoc

* FIX eqeq and no-eq-null

* ADD lint to travis

* UPDATE test env for eslint
2019-12-30 22:01:46 +05:30
Mt
e61410a757 add new config cornerExternalLinkTarget for the corner link target
rm   CNAME

add CNAME

add repo test

back to the origin index.html

fix: the Git corner displayed bigger when the externalLinkTarget = ''

[update] a new independent config for corner link target attribute.

[update doc] add the `cornerExternalLinkTarget` config in the doc.
2019-12-02 18:10:42 +08:00
Mt
12d80f64c9 fix:Link target of repo's GitHub Corner according to externalLinkTarget config. #835 2019-05-10 10:26:01 +08:00
cinwell.li
1a945d445a
fix(cover): Compatible with legacy styles, fixed #677 (#678)
Please makes sure these boxes are checked before submitting your PR, thank you!

* [ ] Make sure you are merging your commits to `master` branch.
* [ ] Add some descriptions and refer relative issues for you PR.
* [ ] DO NOT include files inside `lib` directory.
2018-11-02 02:14:02 +08:00
cinwell.li
fcd1087c16
fix: cover button style, fixed #670, fixed #665 (#675)
Please makes sure these boxes are checked before submitting your PR, thank you!

* [x] Make sure you are merging your commits to `master` branch.
* [x] Add some descriptions and refer relative issues for you PR.
* [x] DO NOT include files inside `lib` directory.

A temporary solution, I will refactor this part of the code in the next major version.
2018-11-01 13:45:34 +08:00
程康
2edf47ec73 fix: update match regex (#669) 2018-11-01 07:09:34 +08:00
John Hildenbiddle
0a0802aded feat: Allow base64, external, and relative logo values (#642)
Fix #577
2018-10-23 15:27:36 +08:00
cinwell.li
ee72dd05e5
feat: add logo option, #264 (#541) 2018-06-19 08:19:21 +08:00
cinwell.li
8352a1e489
refactor: build config (#408)
* refactor: build config

* chore: fix conflict

* fix: 404 page path
2018-03-03 22:51:27 +08:00
Romain Lenzotti
9b3b4454de feat(config): Add 404 page options. (#406)
This feature add the notFoundPage options to customize the default 404 page
with a markdown file. It also support the localisation.
2018-03-03 22:09:01 +08:00
Romain Lenzotti
0933445e89 fix(navbar): Now Navbar isn't append to DOM when loadNavbar is falsy (#407) 2018-03-03 21:34:42 +08:00
Romain Lenzotti
278a75ebd5 fix(render): Disable markdown parsing when the file is an HTML (#403) 2018-03-01 22:27:30 +08:00
qingwei.li
6a09059645 fix(hook): beforeEach don\'t work, fixed #393 2018-02-15 18:34:19 +08:00
qingwei.li
62ce447fc3 refactor(embed): async fetch embed files, fixed #387 2018-02-12 16:25:28 +08:00
qingwei.li
033be4f2d7 fix: onlyCover 2018-02-11 22:22:06 +08:00
qingwei.li
ebc10c4e43 fix: ssr compatible embedd 2018-02-11 22:22:06 +08:00
qingwei.li
b265fdd68a feat(cover): add onlyCover option, close #382 2018-02-11 22:22:06 +08:00
qingwei.li
524f52f882 feat(compiler): support embedded markdown, html, video, etc files, close #383, close #333 2018-02-11 22:22:06 +08:00
qingwei.li
b8dd346baf fix(render): Remove getRootNode to be compatible with the lower version of Chrome, fixed #225 2017-07-26 18:52:36 +08:00
qingwei.li
17ff3d1506 fix: style rerender due to setting themeColor 2017-07-24 18:57:41 +08:00
qingwei.li
9af855921e
fix: not found page 2017-07-09 10:48:41 +08:00