@@ -316,29 +316,36 @@ class Parse {
316316 }
317317
318318 private handleYamlBreaker ( value : string , localSettings : LocalSettings , isInline ?: boolean ) : string {
319- // Do nothing if is inline
320- if ( isInline ) {
321- return value ;
322- }
323-
324319 // Remove a possible already existing quote wrapper
325320 if ( value . startsWith ( '"' ) && value . endsWith ( '"' ) ) {
326321 value = value . substring ( 1 , value . length - 1 ) ;
327322 }
328323
324+ // Wrap in quotes if is configured to do so
325+ if ( localSettings . frontmatter_quote_wrap ) {
326+ return this . wrapWithQuotes ( value ) ;
327+ }
328+
329+ // Do nothing if is inline
330+ if ( isInline ) {
331+ return value ;
332+ }
333+
329334 // Check possible markdown breakers of the yaml
330335 if ( MarkdownBreakerRules . INIT_CHARS . some ( c => value . startsWith ( c ) ) ||
331336 MarkdownBreakerRules . BETWEEN_CHARS . some ( rule => value . includes ( rule ) ) ||
332- MarkdownBreakerRules . UNIQUE_CHARS . some ( c => value === c ) ||
333- localSettings . frontmatter_quote_wrap ) {
334- value = value . replaceAll ( `\\` , `` ) ;
335- value = value . replaceAll ( `"` , `\\"` ) ;
336- return `"${ value } "` ;
337+ MarkdownBreakerRules . UNIQUE_CHARS . some ( c => value === c ) ) {
338+ return this . wrapWithQuotes ( value ) ;
337339 }
338-
339340 return value ;
340341 }
341342
343+ private wrapWithQuotes ( value : string ) : string {
344+ value = value . replaceAll ( `\\` , `` ) ;
345+ value = value . replaceAll ( `"` , `\\"` ) ;
346+ return `"${ value } "` ;
347+ }
348+
342349 /**
343350 * Singleton instance
344351 * @returns {VaultManager }
0 commit comments