mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-30 01:32:44 +00:00
Fix #547 quote snbt keys + respect indentation
This commit is contained in:
@@ -30,7 +30,13 @@ const FORMATS: Record<string, {
|
||||
},
|
||||
snbt: {
|
||||
parse: async (v) => NbtTag.fromString(v).toSimplifiedJson(),
|
||||
stringify: (v, _i) => jsonToNbt(v).toPrettyString(),
|
||||
stringify: (v, i) => {
|
||||
const tag = jsonToNbt(v)
|
||||
if (i === undefined) {
|
||||
return tag.toString()
|
||||
}
|
||||
return tag.toPrettyString(typeof i === 'number' ? ' '.repeat(i) : i)
|
||||
},
|
||||
},
|
||||
yaml: {
|
||||
parse: async (v) => yaml.load(v),
|
||||
|
||||
Reference in New Issue
Block a user