Switch to vkbeautify for XML

https://feedback.yaak.app/p/xml-pretty-formatter-not-rendering-correctly
This commit is contained in:
Gregory Schier
2025-10-28 14:03:49 -07:00
parent a71fb8ed6c
commit 484b5b2fd8
9 changed files with 15 additions and 362 deletions

View File

@@ -1,3 +1,4 @@
import vkBeautify from 'vkbeautify';
import { invokeCmd } from './tauri';
export async function tryFormatJson(text: string): Promise<string> {
@@ -23,8 +24,7 @@ export async function tryFormatXml(text: string): Promise<string> {
if (text === '') return text;
try {
const result = await invokeCmd<string>('cmd_format_xml', { text });
return result;
return vkBeautify.xml(text, ' ');
} catch (err) {
console.warn('Failed to format XML', err);
}

View File

@@ -15,7 +15,6 @@ type TauriCmd =
| 'cmd_dismiss_notification'
| 'cmd_export_data'
| 'cmd_format_json'
| 'cmd_format_xml'
| 'cmd_get_http_authentication_config'
| 'cmd_get_http_authentication_summaries'
| 'cmd_get_sse_events'