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

blockHeader function improvement #362

Closed
doiftrue opened this issue Nov 1, 2015 · 6 comments
Closed

blockHeader function improvement #362

doiftrue opened this issue Nov 1, 2015 · 6 comments
Milestone

Comments

@doiftrue
Copy link

doiftrue commented Nov 1, 2015

Look to this example, assume we trying to parse this header:
### #header text
We get <h3>header text</h3> but not <h3>#header text</h3> as it's on github or anywhere else. It's because of this line in blockHeader function:

$text = trim($Line['text'], '# ');

I suggest replace it with two lines:

$text = trim($Line['text'], '#');
$text = trim($text);

Thanks for code and hope you repair this in next release.

@kminchev
Copy link

kminchev commented Nov 1, 2015

Workaround is \#header

@doiftrue
Copy link
Author

doiftrue commented Nov 1, 2015

Thanks, I know about \#header but it's bad option for me. I make wrapper class for parsedown and add my blockHeader method.

For example here on github if a write ### #header I get #header not header and I think it's more correctly.

@erusev
Copy link
Owner

erusev commented Nov 1, 2015

@doiftrue it is indeed more correct - i'll fix it as soon as i get a chance

@doiftrue
Copy link
Author

doiftrue commented Nov 1, 2015

Thanks a lot!

@praveenscience
Copy link

Guess in simple terms, we can make it using double trim() like this:

$text = trim(trim($Line['text'], '#'));

@aidantwoods
Copy link
Collaborator

Looks like I added an equivalent fix in #583, this will be in the next version :)

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

No branches or pull requests

5 participants