ts-stack/markdown

Escaping `{` into `{{ '{' }}`?

SamuelMarks opened this issue · 0 comments

Nice work with marked-ts!


Wrote a little script to allow Angular to support Markdown, using marked-ts.

Given b.component.md:

## Hello
<div *ngIf="true">
```bash
echo ${5}
```
</div>

It generates:

<h2 id="hello">Hello</h2>
<div *ngIf="true">
<code>bash
echo ${5}</code>
</div>

How would I escape things Angular doesn't support?

Namely, I want to generate:

<h2 id="hello">Hello</h2>
<div *ngIf="true">
<code>bash
echo ${{'{'}}5{{'}'}}</code>
</div>

EDIT_0: I can't escape with NgNonBindable due to angular/angular#11859
EDIT_1: Wrote a very basic custom post processing for this:
https://github.com/SamuelMarks/ng-md-components/blob/ceec9783881a2864fe5e2fff82bec115895733de/index.ts#L73-L91