text-to-xml-safe-string README
Formats text to XML safe string, replace linebreaks (\n), tabs (\t), and special characters (&, ', ", <, >)
Installation
Published and distributed on the VSCode Marketplace
Features
- Select text that you want formatted
- Open command palette with cmd+shift+p (Mac) or ctrl+shift+p (Windows)
- Search and select command "Text To XML Safe String"
- The string will be inserted below your selection, wrapped in quotes for use in code
Example
Input:
sql.Exec(`
SELECT * FROM some_table
WHERE name = $1
`, "John Doe")
Output:
"sql.Exec(`\n\tSELECT * FROM some_table\n\tWHERE name = $1\n`, "John Doe")"
TODO
Configuration option for wrapping output in quotes or other text
Output should be inserted after entire selection, not where the cursor ends the selection when select dragging
Contributing
Please contribute!
License
MIT © 2020 gpng
| |