pytest-check-links
pytest-check-links copied to clipboard
Include line number in report of failed link.
It'd be nice if it included the line number in the report of failed link.
Hi @reagle! I not sure if this is possible since we convert the documents to html prior to checking the links. The actual link url might not even be in the original document.
Ah, I see. I appreciate that this worked on markdown but I can see the problem. I was hoping I could set a pattern in iTerm such that clicking on it opened it in my editor (as I do with Python exceptions) or could even use in my editor (as I do with linting). How do you do the conversion?
We do the conversion here and then parse the document here. We might be able to get the line number from the parsed html, but at that point we don't know what type the original document was.
The only hack I can think of is to preprocess the markdown line number as an attribute prior to conversion. Using pandoc's syntax for link attributes, something like:
"""
{#id .class width=30 height=20px ln=23}
"""
A more generic approach would to be use something like pandoc to parse the AST and check link types there. The new commonmark parser in commonmark-hs is supposed to have source information which could yield line numbers....?
I don't have the bandwidth to work on this, but would support something along these lines.
Fair enough. I'm not prepared to take this on myself.