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'

View File

@@ -1,2 +1,2 @@
declare module 'format-graphql';
declare module 'xml-beautify';
declare module 'vkbeautify';

View File

@@ -65,12 +65,13 @@
"remark-gfm": "^4.0.1",
"slugify": "^1.6.6",
"uuid": "^11.1.0",
"vkbeautify": "^0.99.3",
"whatwg-mimetype": "^4.0.0",
"xml-beautify": "^1.2.3",
"yaml": "^2.6.1"
},
"devDependencies": {
"@lezer/generator": "^1.8.0",
"@tailwindcss/container-queries": "^0.1.1",
"@tailwindcss/nesting": "^0.0.0-insiders.565cd3e",
"@tanstack/router-plugin": "^1.127.5",
"@types/node": "^24.0.13",
@@ -83,7 +84,6 @@
"@types/whatwg-mimetype": "^3.0.2",
"@vitejs/plugin-react": "^4.6.0",
"autoprefixer": "^10.4.21",
"@tailwindcss/container-queries": "^0.1.1",
"decompress": "^4.2.1",
"eslint-plugin-react-refresh": "^0.4.20",
"internal-ip": "^8.0.0",