Skip to content

Commit

Permalink
fix(code-block): prism client and prerendered syntax highlighting (#1973
Browse files Browse the repository at this point in the history
)

* fix(code-block): prism clinet and prerendered syntax highlighting

* chore(code-block): add changeset

* chore(code-block): update changeset verbiage

Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]>

---------

Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]>
  • Loading branch information
adamjohnson and bennypowers authored Oct 8, 2024
1 parent e59f64c commit 613e827
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/nasty-wolves-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rhds/elements": patch
---

`<rh-code-block>`: ensure that syntax colours and styles are applied when the element upgrades
2 changes: 1 addition & 1 deletion elements/rh-code-block/docs/30-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use the correct mime type for your content, e.g. `text/html` for HTML content.

<rh-alert state="warning">
<h3 slot="header">Warning</h3>
<p>When slotting HTML content into the code-block, if that HTML content contains a `</script>` end tag, you must escape it.</p>
<p>When slotting HTML content into the code-block, if that HTML content contains a <code>&lt;/script&gt;</code> end tag, you must escape it.</p>
</rh-alert>

One approach to escaping script tags that is to close the containing `<script
Expand Down
1 change: 1 addition & 0 deletions elements/rh-code-block/rh-code-block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export class RhCodeBlock extends LitElement {
override connectedCallback() {
super.connectedCallback();
this.#ro.observe(this);
this.#onSlotChange();
}

override disconnectedCallback() {
Expand Down

0 comments on commit 613e827

Please sign in to comment.