mirror of
https://github.com/go-gitea/gitea.git
synced 2025-12-14 16:33:57 +01:00
Example Frontend Render Plugin
This directory contains a minimal render plugin that highlights .txt files
with a custom color scheme. Use it as a starting point for your own plugins or
as a quick way to validate the dynamic plugin system locally.
Files
manifest.json— metadata (including the requiredschemaVersion) consumed by Gitea when installing a pluginrender.js— an ES module that exports arender(container, fileUrl)function; it downloads the source file and renders it in a styled<pre>
Build & Install
-
Create a zip archive that contains both files:
cd contrib/render-plugins/example zip -r ../example-highlight-txt.zip manifest.json render.js -
In the Gitea web UI, visit
Site Administration → Render Plugins, uploadexample-highlight-txt.zip, and enable it. -
Open any
.txtfile in a repository; the viewer will display the content in the custom colors to confirm the plugin is active.
Feel free to modify render.js to experiment with the API. The plugin runs in
the browser, so only standard Web APIs are available (no bundler is required
as long as the file stays a plain ES module).