mikaelbr / marked-terminal

A Renderer for the marked project. Allowing you to render Markdown to print to your Terminal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ordered lists not output correctly.

eoinkelly opened this issue · comments

I ran into a problem when using this lib to make a colorized terminal markdown pager. The current implementation of changeToOrdered assumes that the text has not had color codes inserted yet. This holds true when it is run within Mocha but not when run outside.

I have reproduced the problem in https://github.com/eoinkelly/marked-terminal/compare/ordered-list-fix - notice that the Mocha test passes but the ordinary node file does not (at least it doesn't on my setup of iTerm2 on MacOS 10.10).

I suspect that whatever environment Mocha sets up for the test causes chalk to not add colors but setting chalk.enabled = true does not seem to fix it.

I haven't had time to poke through Mocha to see what is necessary to persuade it to play nicely.

I'm happy to add a fix to changeToOrdered to account for the colors - let me know if I should do that. In either case I thought you should know about the Mocha thing.

I think this might be fixed now, @eoinkelly? Due to rewrites in 97681d7

Yep, I haven't been able to reproduce on current master.