bikeshed icon indicating copy to clipboard operation
bikeshed copied to clipboard

Preserve nodes on code includes

Open tpluscode opened this issue 3 years ago • 6 comments

Specifically, I wrap my code snippets with a Custom Element which presents them as tabs. It would look like this in code

<s2q-snippet>
  <pre class="include-code" slot="shape">
  path: example/values-focus-node.ttl
  highlight: turtle
  </pre>

  <pre class="include-code" slot="query">
  path: example/values-focus-node.ttl.rq
  highlight: sparql
  </pre>
</s2q-snippet>

The element s2q-snippet renders a two tabs and distributes the snippets in two slots, shape and query

Problem is, that the [slot] attributes are not preserved in the output if bikeshed.

-<pre class="include-code highlight" slot="shape">
+<pre class="include-code highlight">

I would expect any additional HTML attributes to be preserved as-is in the rendered HTML

tpluscode avatar Feb 26 '23 11:02 tpluscode

Yeah, I should fix this. Right now I just generate a brand-new element holding the attributes I parsed from the contents, but merging into the existing element is definitely doable.

tabatkins avatar Feb 27 '23 19:02 tabatkins

Okay, doing this was a larger project than I thought, but it was worthwhile! Should all be good, but lmk if you have any issues.

tabatkins avatar Mar 10 '23 00:03 tabatkins

Worked well for my use case. Thanks!

While I have your attention, could you merge #2093? I rebase and updated a number of times to sync with latest changes :)

tpluscode avatar Mar 10 '23 09:03 tpluscode

Reopening because this is temporarily reverted while I bake the code more. See https://github.com/speced/bikeshed/issues/1773#issuecomment-1481598821 for details.

tabatkins avatar Mar 23 '23 17:03 tabatkins

Hello. Any chance to revisit this?

tpluscode avatar Aug 17 '23 13:08 tpluscode

Yup, the "temporary" revert is lasting longer than planned, but it should be finished this quarter.

tabatkins avatar Aug 17 '23 18:08 tabatkins