Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Move away from using BrowserWindow for source view #163

Open
pestevez opened this issue Mar 11, 2021 · 0 comments
Open

Move away from using BrowserWindow for source view #163

pestevez opened this issue Mar 11, 2021 · 0 comments

Comments

@pestevez
Copy link
Contributor

The Source view uses webview with the view-source: prefix applied to the URL to get a formatted view of the Instant Articles markup.

This implementation gets the jobs done well, but it is preventing us from storing in the client the response from the preview webserver and forces us to to a loadURL. We should try to replace the BrowserWindow (webview) with an HTML view of the formatted code.

There ara multiple libraries that we could leverage, like Prism. I can think of a few approaches:

  1. We show the unformatted code and the library used takes care of the formatting using JS and CSS.
  2. We format the code from Node (for example, using prismjs and display the formatted text.
  3. We use a pre-existing React component that displays formatted code (without using a webview).

I found this tutorial that describes something similar https://betterstack.dev/blog/code-highlighting-in-react-using-prismjs/

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant