Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add escape filter for three back-thrashes #101

Closed
wf9a5m75 opened this issue Sep 18, 2018 · 2 comments
Closed

Add escape filter for three back-thrashes #101

wf9a5m75 opened this issue Sep 18, 2018 · 2 comments
Labels
information Informational statement/issue question Issue representing a how-to question

Comments

@wf9a5m75
Copy link

Thank you for resolving #98.
I really appreciate for your help. You saved my time a lot!

Let me ask one more thing.
Is it possible to escape the contents of three back-thrashes?

I would like to create a code example site with this module.
In order to manage example code and actual code, I would like to write example code in html side.

However because of Angular, it seems I have to write { to { and } to }.

screen shot 2018-09-17 at 9 49 55 pm

screen shot 2018-09-17 at 9 51 30 pm

Well, I can write escaped HTML characters, but is it possible to write { } then escape them automatically?

@jfcere
Copy link
Owner

jfcere commented Sep 19, 2018

Double curly braces

There is a ngNonBindable directive available that can be used to avoid double curly braces to be compiled/bind.

<div ngNonBindable>
  This will show {{ double curly braces }} in HTML
</div>

Single curly braces

Sadly there is currently an issue on Angular repository about single curly braces that is throwing a compilation error even when using that same directive.

<div ngNonBindable>
  This will throw a compilation error for { single curly braces }
</div>

Workaround: remote files

The best workaround I found to avoid escaping characters is to keep the code snippets in remote files and use src property of the markdown component/directive to fetch it. That way you can just copy-paste your code and it won't get compiled/bind by Angular.

<div markdown [src]="'path/to/file.js'"></div>

You can look at the issue #40 for details on how to load external files if you're having trouble with it.

@jfcere jfcere added question Issue representing a how-to question information Informational statement/issue labels Sep 19, 2018
@wf9a5m75
Copy link
Author

Yes, it's perfect!! Thank you for telling that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
information Informational statement/issue question Issue representing a how-to question
Projects
None yet
Development

No branches or pull requests

2 participants