An extensible, general purpose http->gemini mirror with full javascript support, live at gemini://
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.4 KiB

how to write a sigil


  • a text editor
  • a browser
  • some knowledge of javascript

getting started

Say we want to write a sigil for "" to get the current times around the world and serve them in gemtext format. Our first step is to create the file and place it in the sigils directory.

writing the sigil

The only necessary part of any sigil is the call to window.electron.send_gemtext(). This function sends any data generated in the browser to the web server.

To start, we can write our sigil to consist only of the line:

window.electron.send_gemtext("This is a test.")

Now, whenever you access "gemini://localhost?" you will be greeted with:

This is a test.

Great! This is not very useful however, as we aren't getting any data from the page.

So, lets add some data! If we navigate to "" using a web browser, we can see the current time for the user's location is displayed near the top of the page. Using the "inspect element" feature we can see that the current time is contained in a time element with the id clock. If we want to use this data in our sigil, we can access it using document.querySelector(), the same way we would in the browser console:

var current_time = document.querySelector("time#clock").innerText

Now, if we want our sigil to send that data, we simply write:


So now our sigil looks like this:

var current_time = document.querySelector("time#clock").innerText

And now, when we access "gemini://localhost?", we see:


(or whatever the time is in your current location)

If we want to display the current date as well, we can find it in the div element with id dd

var current_date = document.querySelector("div#dd").innerText

And send the entire thing as a string back to the web server:

var current_time = document.querySelector("time#clock").innerText
var current_date = document.querySelector("div#dd").innerText
window.electron.send_gemtext(current_time + "\n\n" + current_date)

Now, when we access "gemini://localhost?" we see:


Friday, April 23, 2021

Of course, sigils can be much more powerful than this. For a good example of a more complex sigil, you can see the * sigil for viewing sourcehut repos.