Skip to content

Feature request: Lexical canonicalization of XML with mdoc #65

@MichaelNorman

Description

@MichaelNorman

It would be nice to be able to round-trip API docs through mdoc in order to standardize white space, attributes, and so on. For example:

mdoc --canonicalize ./Application.xml

would result in Application.xml being loaded into whatever XML libraries that mdoc uses and being written back to itself. Something like:

mdoc --canonical-diff-only ./Application.xml

would do the same thing, except report what it would do to stdout, rather than writing back to Application.xml.

If the filespec were omitted, perhaps the default behavior would be to recurse over the current directory. Since it is likely that this command would be run on altered but not committed files, it might make sense to have an explicit --no-confirm option, and have the default mode be interactive.

The motivation for this is to reduce clutter in commits and to allow greater freedom for authors to script their own solutions to adding/removing/changing content with the XML toolchain of their choice, simply canonicalizing their files afterward. Also, more modern XML-handling libraries, such as Linq to XML, have arrived on the scene, so this would enhance the writers' scripting experience while allowing mdoc and its developers to remain locked in the past with XmlDocument and its ilk, unperturbed by requests to update the XML engine to ease writers' pain.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions