javascript - How can I call npm module from PHP class -
i found javascript plugin convert html markdown here https://github.com/domchristie/to-markdown.
i'm using laravel 5. let's user post html string , take request php class. here's controller:
<?php class thecontroller extends controller { ... public function index() { $html_text = request::input('html_text'); // convert $html_text $markdown } } ?>
if in javascript file could've called function this:
var tomarkdown = require('to-markdown'); tomarkdown('<h1>hello world!</h1>');
how convert $html_text
$markdown
without converting text file , read it, if possible
you shouldn't use npm package that, there plenty php packages this. can find lot of packages compatible laravel on packalyst.
for example: http://packalyst.com/packages/package/alfredo-ramos/parsedown-extra-laravel
Comments
Post a Comment