-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
How to: Line break creates a line break #326
Comments
As per Markdown documentation, line breaks are added with 2 empty spaces at the end. You can enable automatic line breaks so every 'enter' will produce line break. More info here: https://github.com/erusev/parsedown/wiki/Usage |
Thanks @kminchev ! A last thing: I'm doing a forum (in which the users write in Markdown), how to disable user input of |
@josephernest If you look a bit below in the same wiki page you'd find the You could also prevent some XSS attacks from user-generated content with the modifications from @naNuke here: #276 (not yet merged!). |
Thanks @kminchev . I saw this option, but in fact I would like to enable HTML in Markdown for "normal things" like How to allow a part of HTML, but disable another ( |
For that you need to run markdown result through DOM parser and blacklist script tags. http://simplehtmldom.sourceforge.net |
@naNuke Which one would you use for just blocking |
@josephernest There is also http://htmlpurifier.org and http://php.net/manual/en/class.domdocument.php I think all these libraries can provide filtering of some sort, but I am not that familiar with them to write you an example for each but good partner for Parsedown would be the native domdocument to keep it fast. You just pass your parsed markdown as parsedown outputs it into a domdocument object as source, then getElementByTagName('script') and remove all of those, everything you need is in the documentation and theres plenty of examples on stackoverflow :) Also if you concern is user submitted javascript then you should remove all events as well, onclick etc... |
You can also use the Content-Security-Policy headers to whitelist only known and approved asset sources and to disallow inline JavaScript. http://www.html5rocks.com/en/tutorials/security/content-security-policy/ |
In usual Markdown, "creating a line break doesn't create a line break" :
will produce this with Parsdown:
Hello there! I'm here.
How to do in order that a line break really creates a line break ?
Can we enable this with an option added to :
?
The text was updated successfully, but these errors were encountered: