lowlighter / libs

🍱 Collection of carefully crafted TypeScript standalone libraries. Minimal, unbloated, convenient.
https://jsr.io/@libs
MIT License
100 stars 12 forks source link

`xml:space="preserve"` is not handled #25

Closed Marcisbee closed 1 year ago

Marcisbee commented 1 year ago

There is an unhandled case where xml:space="preserve" is not taken into account.

Input:

<t xml:space="preserve">  there are two spaces here  </t>

Current output:

{
  t: {
    "@xml:space": "preserve",
    "#text": "there are two spaces here"
  }
}

According to w3 spec it should instead return something closer to this: Expectation:

{
  t: {
    "@xml:space": "preserve",
    "#text": "  there are two spaces here  "
  }
}

or this

{
  t: "  there are two spaces here  "
}
lowlighter commented 1 year ago

Hi 👋 !

Sorry for the delay, the directive should be supported as expected with the new release. The output will be like the first result you posted (in order to be consistent with how attributes are currently handled)

We could add support for the later through an option if this is something requested