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

FR: check link validity #39

Open
TomRoche opened this issue Dec 31, 2015 · 2 comments
Open

FR: check link validity #39

TomRoche opened this issue Dec 31, 2015 · 2 comments

Comments

@TomRoche
Copy link

Mostly I use restview to view a reST file (always composed in emacs) before I upload it to some repo or wiki. Occasionally I use it to send HTML email, mostly to Gmail users. I don't normally send HTML mail, but when I do, it's like this:

  1. render a file (e.g., mail.rst) until it looks the way I want
  2. generate HTML (by C-u in the browser, then cut'n'paste into another file (e.g., mail.html)
  3. send mail.html from emacs (yes, I'm one of "those people" :-)
    • as a MIME attachment, but inline (so it doesn't look like an attachment).
    • BCCing me, so I know what it looks like. Usually I'll send myself a test post first, so I can be sure of how Gmail renders it ... which may not be the same as restview+firefox renders it.

And, just now, I found a way that Gmail renders better--or at least, more user-friendly-ly--than restview. In reST, I have a tendency to create one-off links like

`foo, and bar <http://foo/bar>`_

until I create the same link several times, whereupon I create a reference, like

.. _foo, and bar: http://foo/bar

and reuse that. Unfortunately, sometimes I forget to remove the angle brackets, and so create a legal-but-useless reference like

.. _foo, and bar: <http://foo/bar>

restview will cheerfully render that, so I thought I was OK until

  1. I generated HTML to a file.
  2. I sent a test email (to myself on Gmail) using the inline-attached HTML.
  3. I opened the email in Gmail.

I then noticed that several links did not display! Whereupon I checked my reST file, and noticed the problem.

So if there's a way to do a simple syntax check of URIs before rendering, and to throw an error on bad URIs, this would probably help users.

@mgedmin
Copy link
Owner

mgedmin commented Dec 31, 2015

Sounds like a good idea.

Maybe it should be a docutils feature though? Would you like to contact them?

@mgedmin
Copy link
Owner

mgedmin commented Dec 31, 2015

BTW I'm not against adding a check for this in restview itself, if upstream proves unresponsive.

I'm not likely to find the time to work on it in the near future, so a pull request would be welcome. I already had code for processing all the links in the document in c444140 (grep for checkLinkSchemes), but removed it when I switched to readme in de44c77. I'm not saying that's the best approach -- maybe overriding some method in SyntaxHighlightingHTMLTranslator would be easier?

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

2 participants