-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Conflict with GitHub’s “New Code View” feature (initially beta, now prod-ish) #643
Comments
Indeed, I can reproduce this conflict. asciidoctor-browser-extension/app/js/loader.js Lines 72 to 74 in fc63d9b
|
This is worst than that, the content-type is but the content is JSON: Since the URL ends with The only workaround I can think of is to disable the extension on the |
Thanks for the quick reply. I think they had similar issues in the past due to wrong Content Type headers; perhaps they’ll be able to fix their new code view. It’s still in beta for a reason, I guess. I’ll tell them about your answer.
Is that even possible? I don’t see anything like a blacklist in the Preferences tab of the Firefox extension. |
I can declare an exception in the manifest but it would be better if GitHub could fix the content-type. |
I think they will, as long as it’s clear that the current behavior of their code view in that regard is not “normal”. Releasing a version of the extension just for that may do more harm than good. |
I tried to reproduce this using Chrome's inspect functionality, but the I wonder why we're seeing different things? |
I see Sidenote: To my surprise, it seems that despite the overwhelming amount of not-so-good feedback, the new code view started becoming the default a few hours ago, with no visible way to disable it (but I may be overlooking something). So for now I’ll disable the extension and have to rely on IDEs to preview AsciiDoc files. 😢 |
I don't know how GitHub does this but they return a different response when the query is sent using XMLHttpRequest or fetch. In the "Developer Tools": > await fetch('https://github.com/yuzutech/kroki/blob/main/README.adoc').then(async (r) => r.headers.get('Content-Type') + '\n' + await r.text())
'text/plain; charset=utf-8\n{"payload":{"allShortcutsEnabled":true,"fileTree":{"":{"items":[{"name":".github","path":".github","contentType":"directory"},{"name":".mvn","path":".mvn","contentType":"directory"},{"name":"blockdiag","path":"blockdiag","contentType":"directory"},{"name":"bpmn","path":"bpmn","contentType":"directory"},{"name":"bytefield","path":"bytefield","contentType":"directory"} If I add an 'text/html; charset=utf-8\n\n\n\n\n\n\n<!DOCTYPE html>\n<html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark" data-a11y-animated-images="system">\n <head>\n <meta charset="utf-8">\n <link rel="dns-prefetch" href="https://github.githubassets.com">\n <link rel="dns-prefetch" href="https://avatars.githubusercontent.com">\n <link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com">\n <link rel="dns-prefetch" href="https://user-images.githubusercontent.com/">\n <link rel="preconnect" href="https://github.githubassets.com" crossorigin>\n <link rel="preconnect" href="https://avatars.githubusercontent.com">\n\n \n\n\n <link crossorigin="anonymous" media="all" rel="styl.... Which is funny because now I get HTML 🤷🏻 |
The first time I tried to display https://github.com/yuzutech/kroki/blob/main/README.adoc, I got a “unicorn” error page from GitHub; maybe the HTML was this. 😆 |
I'm a little out of my depth with how this all works. Is there any specific feedback you think might be useful to the GitHub team responsible for this. Do you think there's a bug with how the content type is being reported? |
Yes. When the request header specifically ask In my opinion, the correct behavior should be:
|
I'm probably missing something obvious but... How do I get this fix applied? The latest release is more than 2 years old. So I guess there is some other place to get a version of this extension with the latest changes? |
I got it to work via https://github.com/asciidoctor/asciidoctor-browser-extension/#firefox-1 but it has to be done again every time you close and reopen the browser. I hope there’ll be a release someday. Not sure GitHub will do anything on their side, with the huge number of issues pertaining to that new code view and the fact that they saw that this extension-side fix popped up. |
I see, so only manually for now... Well, thanks for the quick reply anyway. |
Sorry about the delay! I will try to publish a hot-fix version using manifest v2 because upgrading to manifest v3 means that I need to maintain two versions of the codebase to support both Firefox and Chrome-based browsers (Chrome, Edge...) |
Version 2.7.1 was published on Opera, Chrome and Firefox (and will hopefully will available soon). Unfortunately, Edge requires to migrate to manifest v3 (see #646 (comment)) 😞 |
Naive question: How long does it usually take? Firefox still seems oblivious to the existence of the new version: https://addons.mozilla.org/en-US/firefox/addon/asciidoctorjs-live-preview/ |
Firefox is doing a manual review even for extensions that have high user ratings and/or when the changes are minimal... I would recommend installing the extension from the xpi file (attached in the release page). |
OK 😆 Done, thanks. First time installing an extension this way. |
By the way, Firefox approved the new version |
Btw, Opera extension page says the extension is published there (copied from Chrome extensions I guess?) without review. So it's kind of weird that it's the last to update... |
Maybe it's my first submission since they enabled auto-publishing 🤔 |
Hi.
When the “New Code Search and Code View” feature preview is enabled in GitHub, trying to open an AsciiDoc file by directly opening a URL (for example by picking one in my web browser’s history in a brand new browser tab) rather by than browsing a tree and clicking a GitHub link leads me to a raw JSON payload. The page displays correctly very briefly then shifts to the JSON.
It seems that this is actually caused by the AsciiDoctor extension trying to render something as if it were a piece of AsciiDoc source. It is even updated periodically:
Example:
The issue suddenly popping up when the “Asciidoctor.js Live Preview” extension is enabled:
The displayed JSON being periodically refreshed:
As far as I can tell, this happens on every AsciiDoc file on GitHub. But again, you have to directly open the URL, not reach the file through a GitHub-internal link.
I contacted GitHub’s support about this and they asked me to make a report about this issue here.
The text was updated successfully, but these errors were encountered: