michelf / php-markdown

Parser for Markdown and Markdown Extra derived from the original Markdown.pl by John Gruber.
http://michelf.ca/projects/php-markdown/
Other
3.42k stars 530 forks source link

How to convert newline to br tag #226

Open euclid1990 opened 8 years ago

euclid1990 commented 8 years ago
  1. Same the GithubMarkdown, when we typing enter, it's preview start new line. But with michelf/php-markdown, we need type twice enter to start new line. Please help me ! Note: I have setup no_markup = true; (So I cant using
    tag in Markdown)
  2. Please solve this bug: When user input: [I'm an inline-style link](javascript:alert('xss')) It allow browser click and alert !
michelf commented 8 years ago

The Markdown syntax for a line break is to add two spaces at the end of a line. Github is twisting the rules when rendering comments, but not when rendering .md files. I'd be willing to accept a patch that implements automatic line breaks as an optional feature though.

PHP Markdown is not a filter for malicious content. Please run an additional filter on the HTML output if you need to protect against scripting attacks. https://michelf.ca/blog/2010/markdown-and-xss/

fliiiix commented 8 years ago

Github style line breaks would be a nice option, since that's the only reason why I need to switch to a different parser. Maybe I have time to program a patch for it.

Lisio commented 8 years ago

Even two additional lines with two spaces at each line didn't place any br tags. How to force it?