Comments (10)
Basically, what I'm asking is, can I inject my own angular directives INTO the content being parsed (like image tags, links, etc....)
from angular-marked.
Hello,
This has come up a few times. Unfortunately there is not an easy to get angular directives to run without impacting code blocks. Theoretically it should be possible to tweak marked's parser to pass non-code block html through angular's $compile but honestly I haven't tried.
Please look at the comment here: #43 (comment)
from angular-marked.
Simply adding this line of code after markdown parsing do the trick
$compile(element.contents())(scope.$parent);
I'll open a Pull Request with an option to compile (default to false)
from angular-marked.
Before you get too far look at this comment: #43 (comment)
You need to ensure that only non-code blocks are processed, otherwise it will be impossible to include angular code within the markdown.
from angular-marked.
I see. I think it would be still possible by injecting ng-non-bindable in marked output of code blocks element.
from angular-marked.
If you can get it to work that would be great. Maybe tap into the highlight
or setRenderer
options.
from angular-marked.
Pull Request is there. But how can I build the dist files ?
from angular-marked.
Ho I understand, I just saw there are some npm scripts defined in package.json :)
I need to rebase the Pull Request because i've changed something in karma configuration that is finally not required when using those scripts.
from angular-marked.
Did you exclude code blocks?
from angular-marked.
Yes, they are excluded by using an internal renderer hook on code and codespan. This hook calls the default renderer and wrap it's output in a <span ng-non-bindable></span>
element.
from angular-marked.
Related Issues (20)
- can custom rules be added? HOT 5
- List of all supported Markdown syntax rules HOT 2
- Not able to load json markdown HOT 6
- hljs highlighting not working HOT 4
- Unknown provider: hc.markedProvider HOT 4
- Use of ng-src HOT 4
- Convert scope.marked to String before using it as a string HOT 8
- How to use markdown for a contentful entry HOT 2
- Code blocks indented by tab HOT 1
- HTML tags in markdown are being stripped HOT 3
- Allow setting options per directive instance. HOT 4
- Tables not rendering HOT 3
- Unable to load in angular-seed app
- Could we support Angular2? HOT 4
- emoji not rendering HOT 2
- Replace marked with marked3 HOT 2
- Security issue in marked 0.3.6
- m.Renderer is not a constructor
- Overriding link renderer skips all the security work made by the default renderer
- Change the way `marked` is imported to keep IE11 support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-marked.