File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @teyuto/docusaurus-plugin-json-export" ,
3- "version" : " 0.2.1 " ,
3+ "version" : " 0.8.0 " ,
44 "description" : " A Docusaurus plugin to export content as JSON files" ,
55 "main" : " src/index.js" ,
66 "keywords" : [
Original file line number Diff line number Diff line change @@ -13,10 +13,13 @@ function parseFrontMatter(content) {
1313 const [ key , ...value ] = line . split ( ':' ) ;
1414 if ( key && value . length ) {
1515 const trimmedKey = key . trim ( ) ;
16- const trimmedValue = value . join ( ':' ) . trim ( ) ;
16+ let trimmedValue = value . join ( ':' ) . trim ( ) ;
17+
18+ trimmedValue = trimmedValue . replace ( / ^ [ " ' ] ( .* ) [ " ' ] $ / , '$1' ) ;
19+
1720 if ( trimmedKey === 'tags' ) {
1821 try {
19- frontMatter [ trimmedKey ] = JSON . parse ( trimmedValue ) ;
22+ frontMatter [ trimmedKey ] = JSON . parse ( trimmedValue ) . map ( tag => tag . replace ( / ^ [ " ' ] ( . * ) [ " ' ] $ / , '$1' ) ) ;
2023 } catch ( e ) {
2124 console . error ( `Error parsing tags: ${ trimmedValue } ` ) ;
2225 frontMatter [ trimmedKey ] = [ ] ;
You can’t perform that action at this time.
0 commit comments