File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed
packages/gatsby-transformer-asciidoc Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,22 @@ In the asciidoc file you can insert your image just by using:
85
85
- In case a ` pathPrefix ` is set it will altered the images location.
86
86
- In case you want to be able to override the defined imagesdir inside of your asciidoc file you have to end the path with a ` @ ` (e.g. ` /images@ ` ).
87
87
88
+ ## Support front/graymatter
89
+
90
+ ``` javascript
91
+ // In your gatsby-config.js
92
+ plugins: [
93
+ {
94
+ resolve: ` gatsby-transformer-asciidoc` ,
95
+ options: {
96
+ attributes: {
97
+ " skip-front-matter" : true ,
98
+ },
99
+ },
100
+ },
101
+ ]
102
+ ```
103
+
88
104
## How to query
89
105
90
106
A sample GraphQL query to get AsciiDoc nodes:
Original file line number Diff line number Diff line change 8
8
},
9
9
"dependencies" : {
10
10
"@babel/runtime" : " ^7.15.4" ,
11
- "asciidoctor" : " ^2.2.5"
11
+ "asciidoctor" : " ^2.2.5" ,
12
+ "gray-matter" : " ^4.0.2"
12
13
},
13
14
"devDependencies" : {
14
15
"@babel/cli" : " ^7.15.4" ,
Original file line number Diff line number Diff line change 1
1
const asciidoc = require ( `asciidoctor` ) ( )
2
+ const grayMatter = require ( `gray-matter` )
2
3
const _ = require ( `lodash` )
3
4
4
5
function unstable_shouldOnCreateNode ( { node } , pluginOptions = { } ) {
@@ -97,6 +98,10 @@ async function onCreateNode(
97
98
pageAttributes,
98
99
}
99
100
101
+ if ( doc . getAttribute ( `front-matter` ) ) {
102
+ asciiNode . frontmatter = grayMatter ( doc . getAttribute ( `front-matter` ) )
103
+ }
104
+
100
105
asciiNode . internal . contentDigest = createContentDigest ( asciiNode )
101
106
102
107
createNode ( asciiNode )
You can’t perform that action at this time.
0 commit comments