4 ms·
For code blocks I created prism-remote. It’s a web component that highlights remote code snippets. Kinda like embedded gists but better, you can display snippet
by WD-42 2y ago
For code blocks I created prism-remote. It’s a web component that highlights remote code snippets. Kinda like embedded gists but better, you can display snippets from any file in a repo:
<prism-remote
src="https://github.com/Fingel/prism-remote/blob/main/prism-remote.js https://github.com/Fingel/prism-remote/blob/main/prism-remot..."
start="1"
end="10"
lang="javascript"
>
</prism-remote>
https://github.com/Fingel/prism-remote https://github.com/Fingel/prism-remote
- danilafe 2y agoThe idea is great, though I think I personally would prefer for this to happen on the server side (during rendering a static site, perhaps), not in the user's browsers. Particularly if the user doesn't enable JS, or has a slow connection.
- account42 2y agoYour example makes the same mistake as the one in the article - linking to a (development) branch rather than a specific commit. Unless it is just example code written for the article (in which case why link to it) stuff is eventually going to move arount and your referenced line numbers will be stale.