prettier / plugin-xml

Prettier XML plugin
MIT License
232 stars 34 forks source link

Calling an embed plugin based on script type #620

Closed elliot-nelson closed 1 year ago

elliot-nelson commented 1 year ago

bracketSameLine

No response

printWidth

No response

tabWidth

No response

xmlWhitespaceSensitivity

strict

xmlSelfClosingSpace

No response

Input XML

It looks like today, there is some logic to detect an element based on its name and format it using its own plugin.

In my case, we have XML that is more like XHTML (it's a BrightScript SceneGraph file). It would be nice if I could use the XML plugin, and detect the `script[type="text/brightscript"]` element and use a separate brightscript plugin for formatting that script tag.

Is this something that would be possible?

Current output XML

<component name="rectangleexample" extends="Scene" >
<script type = "text/brightscript" >
<![CDATA[
init()
]]>
</script>
</component>

Expected output XML

See above ^
kddnewton commented 1 year ago

Yeah for sure. I've opened a PR to do that.

kddnewton commented 1 year ago

I'm going to release this as part of the prettier v3 release, so just waiting on that.