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

Helper doesn't parse amp-img #9

Open
stefany-newman opened this issue Aug 17, 2018 · 3 comments
Open

Helper doesn't parse amp-img #9

stefany-newman opened this issue Aug 17, 2018 · 3 comments

Comments

@stefany-newman
Copy link

stefany-newman commented Aug 17, 2018

If the markdown contains <amp-img> tags, the plugin just prints them, rather than parsing them. Please help.

@doowb
Copy link
Member

doowb commented Aug 17, 2018

I think this needs to be added as a plugin to remarkable to be able to render those tags the way you'd like. I'll have to double check, but I don't think this helper will pass plugins to remarkable.

@stefany-newman
Copy link
Author

^^ Thank you doowb, what do you suggest I do? Can I turn remarkable into a Handlebars helper?

@stefany-newman
Copy link
Author

SOLUTION:

I got showdown.js and transformed it into a handlebars helper with this code:

// Markdown -> (AMP)HTML 
Handlebars.registerHelper('showdown_helper', function(text) {
    var showdown  = require('showdown'),
    converter = new showdown.Converter(),
    html      = converter.makeHtml(text);
    return new Handlebars.SafeString(html);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants