@@ -3,7 +3,6 @@ const DocsSidebarNavigation = require('./docs-sidebar.js')
3
3
const fs = require ( 'fs-extra' )
4
4
const path = require ( 'path' )
5
5
// const CopyWebpackPlugin = require('copy-webpack-plugin')
6
- const vuepressTabs = require ( 'vuepress-tabs' )
7
6
8
7
const HighlightDsl = require ( './highlight-dsl' )
9
8
const HighlightRules = require ( './highlight-rules' )
@@ -15,8 +14,8 @@ module.exports = {
15
14
description : 'This is a preview of the main parts of the documentation, found in the openhab/openhab-docs repository' ,
16
15
dest : 'vuepress' ,
17
16
host : 'localhost' ,
17
+ plugins : [ 'tabs' , 'container' ] ,
18
18
base,
19
- shouldPrefetch : ( ) => false ,
20
19
head : [
21
20
[ 'link' , { rel : 'stylesheet' , href : `/fonts/fonts.css` } ] ,
22
21
[ 'link' , { rel : 'icon' , href : `/favicon.ico` } ] ,
@@ -29,42 +28,39 @@ module.exports = {
29
28
// ['meta', { property: 'og:description', content: 'a vendor and technology agnostic open source automation software for your home' }],
30
29
// ['script', { src: `https://identity.netlify.com/v1/netlify-identity-widget.js` }]
31
30
] ,
32
- markdown : {
33
- config : ( md ) => {
34
- vuepressTabs ( md )
35
- md . options . linkify = true
36
- const highlight = md . options . highlight
37
- md . options . highlight = ( str , lang ) => {
38
- if ( ! Prism . languages . dsl || ! Prism . languages . rules ) {
39
- Prism . languages . dsl = HighlightDsl
40
- Prism . languages . rules = HighlightRules
41
- }
42
-
43
- if ( [ 'nginx' , 'bash' , 'python' , 'js' , 'javascript' , 'groovy' ] . indexOf ( lang ) >= 0 ) return highlight ( str , lang )
31
+ extendMarkdown ( md ) {
32
+ md . options . linkify = true
33
+ const highlight = md . options . highlight
34
+ md . options . highlight = ( str , lang ) => {
35
+ if ( ! Prism . languages . dsl || ! Prism . languages . rules ) {
36
+ Prism . languages . dsl = HighlightDsl
37
+ Prism . languages . rules = HighlightRules
38
+ }
44
39
45
- /* Simple heuristics to detect rules & other openHAB DSL code snippets and override the language */
46
- if ( str . match ( / \b (?: C o l o r | C o n t a c t | D i m m e r | G r o u p | N u m b e r | P l a y e r | R o l l e r s h u t t e r | S w i t c h | L o c a t i o n | F r a m e | D e f a u l t | T e x t | G r o u p | S e l e c t i o n | S e t p o i n t | S l i d e r | C o l o r p i c k e r | C h a r t | W e b v i e w | M a p v i e w | I m a g e | V i d e o | I t e m | T h i n g | B r i d g e | T i m e | T y p e | S i t e m a p | s i t e m a p ) \b / ) ) {
47
- lang = 'dsl'
48
- }
49
- if ( str . match ( / \b (?: S t r i n g | D a t e T i m e ) \b / ) && lang !== 'java' && lang !== 'xml' ) {
50
- lang = 'dsl'
51
- }
52
- if ( ( str . match ( / \b r u l e \b / ) && str . match ( / \b w h e n \b / ) && str . match ( / \b t h e n \b / ) && str . match ( / \b e n d \b / ) ) ||
53
- str . match ( / r e c e i v e d u p d a t e / ) || str . match ( / c h a n g e d .* (?: f r o m | t o ) / ) || str . match ( / C h a n n e l .* t r i g g e r e d / ) ||
54
- str . match ( / \b v a l \b / ) || str . match ( / \b v a r \b / ) /* <-- dangerous! */ ) {
55
-
56
- lang = 'rules'
57
- }
58
- if ( lang === 'shell' || lang === 'sh' || lang === 'shell_session' ) lang = 'bash'
59
- if ( lang === 'conf' ) lang = 'dsl'
60
- if ( lang === 'JSON' ) lang = 'json'
61
- // if (lang === 'xtend' || lang === 'text' || !lang) {
62
- // console.log('Cannot determine language of code: ' + lang)
63
- // console.log(str)
64
- // }
40
+ if ( [ 'nginx' , 'bash' , 'python' , 'js' , 'javascript' , 'groovy' ] . indexOf ( lang ) >= 0 ) return highlight ( str , lang )
65
41
66
- return highlight ( str , lang )
42
+ /* Simple heuristics to detect rules & other openHAB DSL code snippets and override the language */
43
+ if ( str . match ( / \b (?: C o l o r | C o n t a c t | D i m m e r | G r o u p | N u m b e r | P l a y e r | R o l l e r s h u t t e r | S w i t c h | L o c a t i o n | F r a m e | D e f a u l t | T e x t | G r o u p | S e l e c t i o n | S e t p o i n t | S l i d e r | C o l o r p i c k e r | C h a r t | W e b v i e w | M a p v i e w | I m a g e | V i d e o | I t e m | T h i n g | B r i d g e | T i m e | T y p e | S i t e m a p | s i t e m a p ) \b / ) ) {
44
+ lang = 'dsl'
45
+ }
46
+ if ( str . match ( / \b (?: S t r i n g | D a t e T i m e ) \b / ) && lang !== 'java' && lang !== 'xml' ) {
47
+ lang = 'dsl'
67
48
}
49
+ if ( ( str . match ( / \b r u l e \b / ) && str . match ( / \b w h e n \b / ) && str . match ( / \b t h e n \b / ) && str . match ( / \b e n d \b / ) ) ||
50
+ str . match ( / r e c e i v e d u p d a t e / ) || str . match ( / c h a n g e d .* (?: f r o m | t o ) / ) || str . match ( / C h a n n e l .* t r i g g e r e d / ) ||
51
+ str . match ( / \b v a l \b / ) || str . match ( / \b v a r \b / ) /* <-- dangerous! */ ) {
52
+
53
+ lang = 'rules'
54
+ }
55
+ if ( lang === 'shell' || lang === 'sh' || lang === 'shell_session' ) lang = 'bash'
56
+ if ( lang === 'conf' ) lang = 'dsl'
57
+ if ( lang === 'JSON' ) lang = 'json'
58
+ // if (lang === 'xtend' || lang === 'text' || !lang) {
59
+ // console.log('Cannot determine language of code: ' + lang)
60
+ // console.log(str)
61
+ // }
62
+
63
+ return highlight ( str , lang )
68
64
}
69
65
} ,
70
66
// configureWebpack: (config, isServer) => {
0 commit comments