mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-06-25 04:21:20 +02:00
#629 - Fix array indent to the new property
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
|
||||
### 🐞 Fixes
|
||||
|
||||
- [#629](https://github.com/estruyf/vscode-front-matter/issues/629): Fix array indent to the new property
|
||||
- [#660](https://github.com/estruyf/vscode-front-matter/issues/660): Allow only to select unique content relationship values
|
||||
- [#661](https://github.com/estruyf/vscode-front-matter/issues/661): Fixing the dropdowns when used at the bottom of a collapsible group
|
||||
- [#664](https://github.com/estruyf/vscode-front-matter/issues/664): Fix for parsing draft status in Hexo and Jekyll
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import * as yaml from 'yaml';
|
||||
import * as jsyaml from 'js-yaml';
|
||||
import * as toml from '@iarna/toml';
|
||||
import { Format, FrontMatterParser } from '.';
|
||||
|
||||
@@ -46,7 +45,16 @@ export const Engines = {
|
||||
parse: (value: string) => {
|
||||
return yaml.parse(removeCarriageReturn(value));
|
||||
},
|
||||
stringify: (obj: any, options?: any) => {
|
||||
stringify: (
|
||||
obj: any,
|
||||
options?: {
|
||||
indent?: number;
|
||||
noArrayIndent?: boolean;
|
||||
skipInvalid?: true;
|
||||
noCompatMode?: true;
|
||||
lineWidth?: number;
|
||||
}
|
||||
) => {
|
||||
// Do our own parsing to keep the comments
|
||||
if (FrontMatterParser.currentContent) {
|
||||
const originalContent = FrontMatterParser.currentContent;
|
||||
@@ -76,9 +84,11 @@ export const Engines = {
|
||||
let updatedValue = docYaml.toJSON();
|
||||
|
||||
return yaml.stringify(updatedValue, {
|
||||
lineWidth: 5000,
|
||||
lineWidth: options?.lineWidth || 5000,
|
||||
defaultStringType: 'PLAIN',
|
||||
keepUndefined: false
|
||||
keepUndefined: false,
|
||||
indent: options?.indent || 2,
|
||||
indentSeq: options?.noArrayIndent ? false : true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user