sotoki icon indicating copy to clipboard operation
sotoki copied to clipboard

Conditionnaly include highlight JS

Open rgaudin opened this issue 4 years ago • 10 comments

Currently, we include highlight JS (and the stack.js stacks that's required to configure it) for all domains. On SE, this is only included for a number of domains.

We should make a request to the homepage of the online domain to find out if it should be enabled or not.

rgaudin avatar Jul 05 '21 12:07 rgaudin

seems like this is not working anymore. no code is highlighted.

yekanchi avatar Dec 25 '22 19:12 yekanchi

@yekanchi You have a precise example in mind on a recent ZIM file?

kelson42 avatar Dec 25 '22 20:12 kelson42

@yekanchi You have a precise example in mind on a recent ZIM file?

As I tested locally and it's the same on the library.kiwix.org, the code fragments of the questions and answers are not highlighted.

yekanchi avatar Dec 26 '22 05:12 yekanchi

@yekanchi Which URL for example?

kelson42 avatar Dec 26 '22 07:12 kelson42

@yekanchi Which URL for example?

https://library.kiwix.org/content/stackoverflow.com_en_all_2022-11/questions/11227809/why-is-processing-a-sorted-array-faster-than-processing-an-unsorted-array

the code is not highilted

yekanchi avatar Dec 26 '22 08:12 yekanchi

To the contrary to upstream article which looks good https://stackoverflow.com/questions/11227809/why-is-processing-a-sorted-array-faster-than-processing-an-unsorted-array

kelson42 avatar Dec 26 '22 08:12 kelson42

Indeed the method used to detect whether a stackoverflow domain uses highlighting or not doesn't work anymore. I'll look for an alternative but maybe it's easier and more future-proof to just enable it unconditionally.

The other conditional feature (mathjax) still works though.

rgaudin avatar Dec 26 '22 12:12 rgaudin

@rgaudin Or create an automated test to secure it works fine still.

kelson42 avatar Dec 26 '22 14:12 kelson42

@rgaudin Or create an automated test to secure it works fine still.

Not quite adapted in this case I think.

We're looking on online source for a clue informing whether highlight was loaded or not (a CSS class). Testing this would mean recording which one is expected to have it, defeating that dynamic behavior. Or we'd do it only on some and not all which would be hazardous given the large number of SE domains.

Also, what happened is a code change online, yet we had no update of the code base for a long time. An action would only break on code change. Or it would have to be scheduled periodic check, which we don't really need otherwise.

I think strengthening the detection by looking for a better source of information is more important but it's not exclusive and a test would help.

rgaudin avatar Dec 26 '22 21:12 rgaudin

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

stale[bot] avatar May 26 '23 17:05 stale[bot]