Embedding Gitea source in external pages?

I’m running Gitea to host my git repos. Many thanks for that, OSS community!

On my blog, I’d like to discuss some code that is stored (publicly) on Gitea. Can anybody think of a way to embed that file directly from git onto my webpage? Like, adding some JS to my page, which would in turn grab that piece of code and render it just like the Gitea page itself? Like, gists?

<script src="https://gist.github.com/datenimperator/5fe86f6a318b7b27a0a934f72af3340d.js"></script>

My blog is all static pages, generated by Jekyll. So a dynamic solution incorporating server-side functionality is out of scope. Regards


1 Like

I think you can do that to link to a raw link of a file. i.e. https://gitea.com/gitea/tea/raw/branch/master/demo.gif

Thx. That’d not give me the nice visual representation of the code editor embedded in Gitea. Eg no line numbers, syntax coloring or else. I see Gitea itself is using the Monaco editor library, probably I’ll build something around that, that’ll pull source from Gitea using the raw URL that you’ve mentioned.

Yeah. It’s better for Gitea to have that feature but unfortunately there is not. But I think it’s not difficult for you to find a javascript code highlight plugin to do that.