Currently, completely refactoring code for vuepress v1, all components should be compatible.
This is the VuePress theme used for personal documentation. It has libaries for markdown-based diagramming tools, sortable/filterable table components and chartjs.
The theme was refactored completely to inherit from the base vuepress theme. Make sure to install the V1 for vuepress yarn install --global [email protected]
Get the latest version of the theme
yarninstall-Dvuepress-theme-cool
Set up .vuepress/config.js. A minimual setup is below, note that mermaid does not need to be included as a plugin.
In addition to use mermaid diagrams add an components, taken from Vuepress Issue 111, obviously I expect vuepress to natively support mermaid, or have tighter integration in the future.
Road to GraduationFirst Year 1AFirst Year 1BAccepted Computer EngineeringENGR 1C (extra courses)Second Year 2AENGR 2.5Second Year 2BENGR 001ENGR 002Third Year (3 classes)Third Year 3BThird Year 3AENGR 003ENGR 004Fourth Year 4BFourth Year 4A
">
// .vuepress/components/sample-timeline.vue<template><timelinetimeline-theme="lightblue"><timeline-titlebg-color="#09FFAA">Road to Graduation</timeline-title><timeline-itembg-color="#9dd8e0">First Year 1A</timeline-item><timeline-itembg-color="#9dFFe0">First Year 1B</timeline-item><timeline-itembg-color="#FFF000">Accepted Computer Engineering</timeline-item><timeline-itembg-color="#cFe8eF">ENGR 1C (extra courses)</timeline-item><timeline-itembg-color="#97Aec8">Second Year 2A</timeline-item><timeline-itembg-color="#5744D4">ENGR 2.5</timeline-item><timeline-itembg-color="#0F4859">Second Year 2B</timeline-item><timeline-itembg-color="#094341">ENGR 001</timeline-item><timeline-itembg-color="#825F03">ENGR 002</timeline-item><timeline-itembg-color="#954F08">Third Year (3 classes)</timeline-item><timeline-itembg-color="#A71490">Third Year 3B</timeline-item><timeline-itembg-color="#C084A9">Third Year 3A</timeline-item><timeline-itembg-color="#7B71C2">ENGR 003</timeline-item><timeline-itembg-color="#2348B1">ENGR 004</timeline-item><timeline-itembg-color="#915F15">Fourth Year 4B</timeline-item><timeline-itembg-color="#0909FA">Fourth Year 4A</timeline-item></timeline></template><script>import{Timeline,TimelineItem,TimelineTitle}from'vue-cute-timeline'exportdefault{components: {
Timeline,
TimelineItem,
TimelineTitle
}}</script>
and render it in the markdown file using .
Using math
Katex can be created within a markdown file by, note that the necessary style sheet for markdown-it-katex is included in Layout.vue .
$x^2=4$
Rendering Charts
Using chartjs and vue-chartkick, allows for easy chart rendering from inside markdown files. What is good about vue-chartkick is highlightjs and google charts can be used instead.
For example the snippet below generates a pie chart, see chartjs for more details.
For sortable and filterable tables, I am using the vue-good-table which has documentation in vuepress. In order to generate tables, use an vue component under .vuepress/components
If you see any bugs feel free to make a pull request at Github or email me. Not a expert in vuepress at all or vue so there are ways to improve my implementations. In addition, some of the components do not work, do not hesitate to message me.
Donate
If you would like to motivate me to spend more time improving open source projects please consider donating.
"yarn dev" is successful, but webpage doesn't show anything. I opened console and saw the following error info:
index.js?5156:3
Uncaught ReferenceError: global is not defined
at eval (index.js?5156:3)
at Object../node_modules/has-symbols/index.js (app.js:3156)
at webpack_require (app.js:769)
at fn (app.js:130)
at eval (GetIntrinsic.js?e9ac:39)
at Object../node_modules/es-abstract/GetIntrinsic.js (app.js:3108)
at webpack_require (app.js:769)
at fn (app.js:130)
at eval (callBind.js?44b7:5)
at Object../node_modules/es-abstract/helpers/callBind.js (app.js:3120)
I can use the vuepress dev . command and see my docs in the browser. However, when I run vuepress build ., I receive the following error:
WAIT Rendering static HTML...
Rendering page: /how-to/ FAIL Error rendering /how-to/:
Error: Cannot find module 'vue-good-table/dist/vue-good-table.css?vue&type=style&index=0&lang=css&'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at r (/Users/jo/.config/yarn/global/node_modules/vue-server-renderer/build.js:8346:16)
at Object.<anonymous> (webpack:/external "vue-good-table/dist/vue-good-table.css:1:0)
at __webpack_require__ (webpack/bootstrap:25:0)
at VueComponent.injectStyles (.vuepress/components/demo-table.vue:6:0)
at VueComponent.hook (Users/jo/.config/yarn/global/node_modules/vuepress/node_modules/vue-loader/lib/runtime/componentNormalizer.js:53:0)
at callHook (/Users/jo/.config/yarn/global/node_modules/vue/dist/vue.runtime.common.js:2919:21)
at VueComponent.Vue._init (/Users/jo/.config/yarn/global/node_modules/vue/dist/vue.runtime.common.js:4624:5)
at new VueComponent (/Users/jo/.config/yarn/global/node_modules/vue/dist/vue.runtime.common.js:4796:12)
at createComponentInstanceForVnode (/Users/jo/.config/yarn/global/node_modules/vue-server-renderer/build.js:7353:10)
at renderComponentInner (/Users/jo/.config/yarn/global/node_modules/vue-server-renderer/build.js:7527:40)
at renderComponent (/Users/jo/.config/yarn/global/node_modules/vue-server-renderer/build.js:7502:5)
at resolve (/Users/jo/.config/yarn/global/node_modules/vue-server-renderer/build.js:7563:9)
⚙