astoff / devdocs.el

Emacs viewer for DevDocs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Additional shr-external-rendering-functions?

xendk opened this issue · comments

Great package, it's the only documentation system (apart from Google) that's stuck for me.

I have a slight issue with the Crystal docs though:

image

Compare with devdocs.io:

image

Now, the problem is that the devdocs scraper relocates the source link to the <h3> containing the signature by simply appending it, which ends up with two <a> elements next to each other with no whitespace between, which shr dutifully renders according to spec.

The proper fix would be to make a PR on devdocs that makes the scraper add in a space, but the activity in their repo tells me that could take a very long time.

So I was wondering if devdocs.el might gain an extra variable where one could add extra custom rendering functions to shr-external-rendering-functions when it rendered (bonus points for making it language scoped)? Apart from adding the ability to fix up annoyances like this, it would also give users a handle to grab if they're simply annoyed by some part of the rendering.

Yes, I've noticed this and a few other glitches (formulas in the PyTorch appear duplicated, etc.). Initially I didn't want to add workarounds for those things, but they seem to be infrequent enough that we could do it.

A PR is welcome (if you have signed the FSF papers or the contribution remains under 15 LOC). Otherwise, if you could paste here the relevant piece of HTML, I might be able to have a look at some point.

Also, I would encourage you to file a bug with devdocs anyway, so they can make their HTML as clean as possible. I guess the point for us is, the HTML should render reasonably without the associated CSS.

I didn't want to add workarounds for those things, but they seem to be infrequent enough that we could do it.

Indeed, you don't want to end up maintaining a "stylesheet" for each and every docset out there.

A PR is welcome (if you have signed the FSF papers or the contribution remains under 15 LOC).

I'll take a stab at it when I have time, it seems like something that could be done in 15 lines. And I should mail assign@fsf.org, it could become handy in the future.

Also, I would encourage you to file a bug with devdocs anyway, so they can make their HTML as clean as possible. I guess the point for us is, the HTML should render reasonably without the associated CSS.

Agree. The fix is just a space.

Great, being able to contribute to ELPA and Emacs is always good idea :-).

When you delve into this, I suggest having a look at the PyTorch manual as well. It contains formulas which are garbled in devdocs.el. Not that you need to fix that, but we should look for some solution that is sufficiently flexible to cover that case too.

I suggest having a look at the PyTorch manual as well.

I'll see what I can do. You have a link to devdocs.io to something that's garbled?