Failed to implement the line selection to URL hack

It would terribly convenient to be able to highlight a bunch of lines in a blog post and link to that selection in a discussion!

Reference message from Diana Coman:

shrysr: note that there is some trouble in that the original thing (which is working on younghands.club too) relies on the structure that apparently is sometimes on different browsers; so there is the original thing described at http://trilema.com/2015/that-spiffy-selection-thing/ AND the latest find of the idiotic behaviour + a solution for it http://trilema.com/2019/proper-html-linking-the-crisis-the-solution-the-resolu

  • Note taken on [2019-07-31 Wed 09:17]
    Summary: By my estimate, I have spent 6-8 hours on this problem in total (at least), starting with moving to Apache from Nginx, and then trying to figure out how to enable this selection to URL feature. Though I believe I have followed the relevant instructions posted on Trilema, this did not work for me. There could be other issues related to package version numbers, and it could also be related to the theme itself. I have no way of really knowing unless I study mp-wp and the current wp. While I did learn things – I let go of important tasks to feed an obsession to have a ‘streamlined system’. For now : I am going to continue posting at s.ragavan.co, and continue posting summaries on younghands.club. This does not have to be viewed as a failure.

    • While the fire was burning – I had the ‘idea’ of using a self-hosted git server, and issues could be used for comments, and it would be possible to select specific lines and also search through the entire code base. A lot more things would also be possible. (refer SO discussion to see what I mean). Later, after all the obsessing, I found that it has to be text or script files to enable line by line anchoring, since markdown and org files are rendered by html by github, and individual lines cannot be selecte. Obviously the open source clones that I’d been looking at would do the same. Refer SO discussion, and issue on github
    • Diana Coman pointed out the pointless nature in this particular endeavor of ‘over-optimising’. There is always a cost to everything. My focus has to be on the learning process and in planning, executing and reviewing it with Diana. Though this thought was running in my head since yesterday – I did not pay heed. It reminded me of Diana’s comment on my dev.to post, and Mocky’s comment, also related to Emacs.
  • Note taken on [2019-07-30 Tue 16:05]
    This requires modifications to the .htaccess file and the theme’s functions.php file. However, in general, it seems that the modifications in the htaccess file can be included in the server configuration itself. If so, this can technically be implemented on nginx as well, and there was no need to switch to apache ??. I have tried this after switching to apache, and with 2 different themes. It did not work. Could this be related to mp-wp versus the current version of wordpress?

Leave a Reply

Your email address will not be published. Required fields are marked *