my-element.ts
import marked from 'marked';
@customElement('my-element')
export class MyElement extends LitElement {
constructor() {
super();
this.markdown = '<h2>Hello World</h2>';
}
@property()
markdown;
override render() {
return html`${marked(this.markdown)}`;
}
}
index.html
<my-element id="md"></my-element>
<script>
document.getElementById('md').markdown = '## hello world';
</script>
In Browser, It's showing with HTML tag
<h2 id="hello-world">hello world</h2>