René's URL Explorer Experiment
Title: Allow .ps1xml files in XML 1.1 · Issue #7526 · PowerShell/PowerShell · GitHub
Open Graph Title: Allow .ps1xml files in XML 1.1 · Issue #7526 · PowerShell/PowerShell
X Title: Allow .ps1xml files in XML 1.1 · Issue #7526 · PowerShell/PowerShell
Description: To enable colored output in output formats, I can write a Format.ps1xml file that uses ANSI color codes like so: \r\n \u003cView>\r\n \u003cName>Medium\u003c/Name>\r\n \u003cViewSelectedBy>\r\n \u003cTypeName>PowerGit.CommitInfo\u003c/TypeName>\r\n \u003c/ViewSelectedBy>\r\n \u003cListControl>\r\n \u003cListEntries>\r\n \u003cListEntry>\r\n \u003cListItems>\r\n \u003cListItem>\r\n \u003c!-- Yellow -->\r\n \u003cLabel>[33mSha\u003c/Label>\r\n \u003cScriptBlock>\"$($_.Sha)$([char]0x001b)[0m\"\u003c/ScriptBlock>\r\n \u003c/ListItem>\r\n \u003cListItem>\r\n \u003cLabel>Author\u003c/Label>\r\n \u003cPropertyName>Author\u003c/PropertyName>\r\n \u003c/ListItem>\r\n \u003cListItem>\r\n \u003cLabel>Date\u003c/Label>\r\n \u003cScriptBlock>\"$($_.Author.When)\"\u003c/ScriptBlock>\r\n \u003c/ListItem>\r\n \u003cListItem>\r\n \u003cLabel>Message\u003c/Label>\r\n \u003cPropertyName>Message\u003c/PropertyName>\r\n \u003c/ListItem>\r\n \u003c/ListItems>\r\n \u003c/ListEntry>\r\n \u003c/ListEntries>\r\n \u003c/ListControl>\r\n \u003c/View>\r\n \u003c/ViewDefinitions>\r\n\u003c/Configuration>\r\n```\r\n\r\nNote the `[33m`, which is `ESC[33m`, which is the ANSI code for yellow, and `$([char]0x001b)[0m`, which is `ESC[0m`, which is the ANSI reset code.\r\nTogether, this will color the whole line yellow:\r\n\r\n\u003cimg width=\"452\" alt=\"image\" src=\"https://user-images.githubusercontent.com/10532611/44112434-6167e756-a005-11e8-8c14-895d27beba56.png\">\r\n\r\njust like in `git log` output:\r\n\r\n\u003cimg width=\"345\" alt=\"image\" src=\"https://user-images.githubusercontent.com/10532611/44112448-6b503818-a005-11e8-88da-5e6dabca365d.png\">\r\n\r\nHOWEVER this is actually not valid XML. Every good XML parser will rightfully complain:\r\n\r\n\u003cimg width=\"378\" alt=\"image\" src=\"https://user-images.githubusercontent.com/10532611/44112545-9eedc992-a005-11e8-8aab-0b435ab94fa1.png\">\r\n\r\nSee https://en.wikipedia.org/wiki/Valid_characters_in_XML#XML_1.0\r\n\r\nWhich means these format files cannot be statically checked, generated, codemodded, etc.\r\n\r\nIt _is_ valid in XML 1.1: https://en.wikipedia.org/wiki/Valid_characters_in_XML#XML_1.1\r\n\r\nBut if I change the parsing instruction to\r\n\r\n```xml\r\n\u003c?xml version=\"1.1\" encoding=\"utf-8\"?>\r\n```\r\n\r\nPowerShell errors:\r\n```powershell\r\nImport-Module : Errors occurred while loading the format data file:\r\n/Users/felix/src/github.com/felixfbecker/PowerGit/PowerGit/Formats/PowerGit.CommitInfo.formats.ps1xml, Error in file /Users/felix/src/github.com/felixfbecker/PowerGit/PowerGit/Formats/PowerGit.CommitInfo.formats.ps1xml: Version number '1.1' is invalid. Line 1, position 16.\r\nAt /Users/felix/src/github.com/felixfbecker/PowerGit/PowerGit/Import-PowerGit.ps1:32 char:1\r\n+ Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath 'PowerG ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n+ CategoryInfo : InvalidOperation: (:) [Import-Module], RuntimeException\r\n+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand\r\n```\r\n\r\nIt effectively already parses XML 1.1 fine though, it just complains about the version.\r\n","author":{"url":"https://github.com/felixfbecker","@type":"Person","name":"felixfbecker"},"datePublished":"2018-08-14T19:08:32Z","url":"https://github.com/PowerShell/PowerShell/issues/7526"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3b4b9258-a43f-1697-6d85-77276d36975f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 80B4:34A55:1920BE:23AD00:6AFD6085 |
| html-safe-nonce | c5d616d9aa7d4a5922ca9bf87e622adf8d44572b5a554052bf76ad1e5d1f1772 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MEI0OjM0QTU1OjE5MjBCRToyM0FEMDA6NkFGRDYwODUiLCJ2aXNpdG9yX2lkIjoiNzczOTUwOTYxNTgyNTM0NjY5MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | cdef072cb83a77cccb92e82f1f62a1f91c4f6780306e332474ed7078b1fc220c |
| hovercard-subject-tag | issue:350559770 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | ///voltron/issues_fragments/issue_layout |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/7526/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3ad16ff81156324bc21201bea010ecc3e1303c99d6c349215079c058b7556b40/PowerShell/PowerShell/issues/7526 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3ad16ff81156324bc21201bea010ecc3e1303c99d6c349215079c058b7556b40/PowerShell/PowerShell/issues/7526 |
| og:image:alt | To enable colored output in output formats, I can write a Format.ps1xml file that uses ANSI color codes like so: |