Last active
October 27, 2020 19:07
-
-
Save mhauri/8a7d6dbcd101e362894d86d45ca2a0bc to your computer and use it in GitHub Desktop.
Tree Extension for gatsby-remark-prismjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In your gatsby-config.js | |
plugins: [ | |
{ | |
resolve: `gatsby-transformer-remark`, | |
options: { | |
plugins: [ | |
{ | |
resolve: `gatsby-remark-prismjs`, | |
options: { | |
languageExtensions: [ | |
{ | |
language: "tree", | |
extend: "json", | |
definition: { | |
'entry-line': [ | |
{ | |
pattern: /\|-- |├── /, | |
alias: 'line-h' | |
}, | |
{ | |
pattern: /\| |│ /, | |
alias: 'line-v' | |
}, | |
{ | |
pattern: /`-- |└── /, | |
alias: 'line-v-last' | |
}, | |
{ | |
pattern: / {4}/, | |
alias: 'line-v-gap' | |
} | |
], | |
'entry-dir': { | |
pattern: /.*[\/](?!\w).*/, | |
inside: { | |
// symlink | |
'operator': / -> /, | |
} | |
}, | |
'entry-symlink': { | |
pattern: /.*\S.* (-> .*)/, | |
inside: { | |
'operator': / -> /, | |
'file': /(.*)/, | |
} | |
}, | |
'entry-name': { | |
pattern: /.*\S.*/, | |
inside: { | |
// symlink | |
'operator': / -> /, | |
} | |
}, | |
}, | |
}, | |
] | |
} | |
}, | |
], | |
} | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment