Skip to content

Instantly share code, notes, and snippets.

@mhauri

mhauri/gatsby-config.js

Last active Oct 27, 2020
Embed
What would you like to do?
Tree Extension for gatsby-remark-prismjs
// 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
You can’t perform that action at this time.