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

Lists not converting to *, but - instead #135

Closed
bkuhl opened this issue Oct 9, 2017 · 7 comments
Closed

Lists not converting to *, but - instead #135

bkuhl opened this issue Oct 9, 2017 · 7 comments

Comments

@bkuhl
Copy link

bkuhl commented Oct 9, 2017

I think I must be missing a step.

$htmlConverter = new HtmlConverter();
$markdown = $htmlConverter->convert($html);

This HTML:

<li>Item1</li><li>Item2</li><li>Item3</li>

Is converting to:

- Item1
- Item2
- Item3

I'm expecting it to come out as:

* Item1
* Item2
* Item3

Are my expectations correct or am I misunderstanding something?

@andreskrey
Copy link
Contributor

Latest commonmark specs says that lists must start with a "bullet list marker" which can be -, + or *.

http://spec.commonmark.org/0.28/#list-items

So I guess html-to-markdown behaves as expected, but giving you less options. Maybe we should have a config param to set the marker type? Is that what you want?

@bkuhl
Copy link
Author

bkuhl commented Oct 9, 2017

Ah, common mark. Wasn't aware that was a thing. Yes, * is needed in my scenario.

@andreskrey
Copy link
Contributor

You can instantiate your own ListConverter and use * instead of -

@colinodell
Copy link
Member

Maybe we should have a config param to set the marker type?

I think that's a great idea!

@manavo
Copy link
Contributor

manavo commented Oct 9, 2017

Will try and do this one

@colinodell
Copy link
Member

This feature is now available in 4.5.0: https://github.com/thephpleague/html-to-markdown/releases/tag/4.5.0 Thank you @manavo for implementing it!

@bkuhl
Copy link
Author

bkuhl commented Oct 9, 2017

Wow, thanks

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

4 participants