Skip to content

Commit

Permalink
Render inline code markup with code formatting (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnSoellnerDev authored Feb 4, 2025
1 parent fad0f64 commit 721a3dd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/paths/index/components/changes/ReleaseNotesItem.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { LitElement, html, css, customElement, property } from 'lit-element';
import marked from 'marked';

@customElement('gr-release-notes')
export default class ReleaseNotesItem extends LitElement {
Expand Down Expand Up @@ -252,14 +253,19 @@ export default class ReleaseNotesItem extends LitElement {
super.update(changedProperties);
}

_parseMarkdown(text) {
// Parse markdown but only return the inner content without wrapping <p> tags
return marked(text).replace(/<\/?p>/g, '');
}

_renderUnifiedItem(viewMode, item) {
return (viewMode === "pretty" ? html`
<li>
<span class="item-change-group">
${item.group}:
</span>
<span>
${item.title}
${html([this._parseMarkdown(item.title)])}
</span>
<code>
(<a
Expand All @@ -279,7 +285,7 @@ export default class ReleaseNotesItem extends LitElement {
return (viewMode === "pretty" ? html`
<li>
<span>
${item.title}
${html([this._parseMarkdown(item.title)])}
</span>
<code>
(<a
Expand Down

0 comments on commit 721a3dd

Please sign in to comment.