File tree Expand file tree Collapse file tree 5 files changed +34
-0
lines changed Expand file tree Collapse file tree 5 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -160,5 +160,6 @@ module.exports = {
160
160
} ,
161
161
'gatsby-plugin-react-helmet' ,
162
162
'gatsby-plugin-catch-links' ,
163
+ 'gatsby-remark-typography' , // only for Russian translation
163
164
] ,
164
165
} ;
Original file line number Diff line number Diff line change 54
54
"request-promise" : " ^4.2.2" ,
55
55
"rimraf" : " ^2.6.1" ,
56
56
"slugify" : " ^1.2.1" ,
57
+ "typograf" : " ^6.8.0" ,
57
58
"unist-util-visit" : " ^1.1.3"
58
59
},
59
60
"engines" : {
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ const Typograf = require ( 'typograf' ) ;
4
+
5
+ exports . onPreExtractQueries = async ( { store, getNodes} ) => {
6
+ const tp = new Typograf ( { locale : [ 'ru' ] } ) ;
7
+ const fields = [ 'title' , 'content' ] ;
8
+ const markdownNodes = getNodes ( ) . filter ( node => {
9
+ return node . internal . type === 'MarkdownRemark' ;
10
+ } ) ;
11
+
12
+ markdownNodes . forEach ( node => {
13
+ fields . forEach ( field => {
14
+ const value = node . frontmatter [ field ] ;
15
+
16
+ if ( ! value ) {
17
+ return ;
18
+ }
19
+
20
+ node . frontmatter [ field ] = tp . execute ( value ) ;
21
+ } ) ;
22
+ } ) ;
23
+ } ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " gatsby-remark-typography" ,
3
+ "version" : " 0.0.1"
4
+ }
Original file line number Diff line number Diff line change @@ -12229,6 +12229,11 @@ typedarray@^0.0.6:
12229
12229
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
12230
12230
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
12231
12231
12232
+ typograf@^6.8.0:
12233
+ version "6.8.0"
12234
+ resolved "https://registry.yarnpkg.com/typograf/-/typograf-6.8.0.tgz#103447a52c23bd19cfe65b81f4e95d36b71879a3"
12235
+ integrity sha512-TsAXy+fDS0g9H6W9CBhnFlvBsRp7Hq5K/fuuBn5X0P86Me9V/YiSTzuXR6TN83AZ0QXyui9o4LLxQFOPmSyxMA==
12236
+
12232
12237
ua-parser-js@^0.7.18:
12233
12238
version "0.7.18"
12234
12239
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.18.tgz#a7bfd92f56edfb117083b69e31d2aa8882d4b1ed"
You can’t perform that action at this time.
0 commit comments