Skip to content

Showcase mode: replace client-side markdown rendering with showdown with server-side rendering #4202

@gadenbuie

Description

@gadenbuie

#4201 brought to my attention that we're using client-side rendering via the showdown JS library to render an app's README.md file in show case mode.

function renderMarkdown() {
const mdContent = document.getElementById("showcase-markdown-content");
if (mdContent !== null) {
// IE8 puts the content of <script> tags into innerHTML but
// not innerText
const content = mdContent.innerText || mdContent.innerHTML;
const showdownConverter = (window as any).Showdown
.converter as showdown.ConverterStatic;
document.getElementById("readme-md").innerHTML =
new showdownConverter().makeHtml(content);
}
}

We now have a strong dependency on commonmark and can handle this rendering server-side, avoiding the additional JavaScript dependency.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions