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

Add error messages for kramdown #459

Closed
flaviut opened this issue Jul 13, 2014 · 4 comments
Closed

Add error messages for kramdown #459

flaviut opened this issue Jul 13, 2014 · 4 comments

Comments

@flaviut
Copy link

flaviut commented Jul 13, 2014

The kramdown filter does not do anything with the messages that kramdown outputs, which makes debugging invalid markdown more difficult.

I'm not sure about the best way to output them, just print them out once the document has been processed?

@gpakosz
Copy link
Member

gpakosz commented Jul 25, 2014

Well I just made the following test:

$ irb
irb(main):001:0> require 'kramdown'
=> true
irb(main):002:0> Kramdown::Document.new('{:foo}this is bogus').warnings
=> ["Found span IAL after text - ignoring it"]

But

irb(main):002:0> require 'kramdown'
=> true
irb(main):003:0> Kramdown::Document.new('this is a [link]
irb(main):004:1'
irb(main):005:1' [link]: foo
irb(main):006:1' [link]: bar').warnings
=> ["Duplicate link ID 'link' on line 5 - overwriting"]

After having discussed with @gettalong it happens not all warnings have line number information so it's not always possible to trace back to the offending Markdown fragment.

While discussing with @gettalong, I wondered whether the warnings array could become an array of hash so that kramdown gives does the job of tracking the line number, the offending content fragment (line excerpt etc).

Then, how would move on from the point kramdown gets more detailed warnings reporting? @ddfreyne, should the kramdown filter format a message to $stderr or is there facility in nanoc we should use to report errors/warnings (something that would understand the verbose flag).

@denisdefreyne
Copy link
Member

There's no warning reporting system other that writing to $stderr. Errors are generally exceptions.

I could adjust the kramdown filter to print warnings, if any, but I fear that it’d cause spam on the screen that people will ignore. Seem like a good idea to do it anyway though.

@denisdefreyne
Copy link
Member

Potential fix in #519.

@denisdefreyne
Copy link
Member

Fixed by #519. Fix will be in 3.7.5!

denisdefreyne added a commit that referenced this issue Jan 11, 2015
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

3 participants