Skip to content

Commit 05c02f6

Browse files
committed
Add in examples for asciidoc frontmatter using using-asciidoc example
1 parent 2748609 commit 05c02f6

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

examples/using-asciidoc/gatsby-config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ module.exports = {
1010
path: `${__dirname}/src`,
1111
},
1212
},
13-
`gatsby-transformer-asciidoc`,
13+
{
14+
resolve: `gatsby-transformer-asciidoc`,
15+
options: {
16+
attributes: {
17+
'skip-front-matter': true
18+
}
19+
}
20+
},
1421
{
1522
resolve: `gatsby-plugin-typography`,
1623
options: {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
:layout: post
3+
source: halkeye
4+
---
5+
= Testing front matter
6+
Doc Writer <[email protected]>
7+
8+
An introduction to http://asciidoc.org[AsciiDoc].
9+
10+
== First Section
11+
12+
* item 1
13+
* item 2
14+
15+
[source,ruby]
16+
puts "Hello, World!"

examples/using-asciidoc/src/templates/article.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,21 @@ class Article extends React.Component {
6666
</tbody>
6767
</table>
6868
)}
69+
{this.props.data.asciidoc.frontmatter && (
70+
<table>
71+
<thead>
72+
<tr>
73+
<td colSpan="2">Frontmatter</td>
74+
</tr>
75+
</thead>
76+
<tbody>
77+
<tr>
78+
<th>frontmatter.source</th>
79+
<td>{this.props.data.asciidoc.frontmatter.source}</td>
80+
</tr>
81+
</tbody>
82+
</table>
83+
)}
6984
<div
7085
dangerouslySetInnerHTML={{ __html: this.props.data.asciidoc.html }}
7186
/>
@@ -98,6 +113,9 @@ export const pageQuery = graphql`
98113
authorInitials
99114
email
100115
}
116+
frontmatter {
117+
source
118+
}
101119
}
102120
}
103121
`

0 commit comments

Comments
 (0)