A script that uses awk to convert Gemtext to HTML
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.
 
 
Unicorn 8343f554e9 Fixed bug that caused lists not to end correctly 3 months ago
LICENSE Updated year in license 3 months ago
README Usability improvements and usage description added 3 months ago
end.html Initial commit 10 months ago
gem2html Fixed bug that caused lists not to end correctly 3 months ago
start.html Initial commit 10 months ago

README

# gem2html
=============
This little script converts Gemtext files to HTML. It was originally created by sloum (sloum.colorfield.space on Gemini and HTTP) with some improvements and extensions by me, unicorn. Sloum gave me permission to publish it as open source software on his behalf. :)

PLEASE READ ABOUT THE LIMITATIONS OF THIS SCRIPT BELOW BEFORE USING IT! It is a very capable script for its small size, but it is far from perfect. Feel free to send patches to unicorn@regrow.earth if you want to share any improvements!

## HOW TO USE
1. Download the gem2html repository:
git clone https://codeberg.org/unicorn/gem2html.git

2. Make the script executable:
cd gem2html
chmod +x gem2html

3. Run gem2html once, this will create the "gemini-public" directory, in which your content will live:
./gem2html

4. Place your Gemtext files in the "gemini-public" directory. You can organize them as you would organize the real site and you can link between them with relative links or absolute links without a domain, like this:
=> /index.gmi This is the home page
=> /blog/post1.gmi First blog post
The script takes care of translating these links for the HTML version of the site, so it would turn them into "/index.html" and "/blog/post1.html".

5. If you want your HTML site to have CSS styling, you can create a styles.css file with styling, which will be copied to the html output folder automatically. You will have to modify the "start.html" file to include the CSS by uncommenting line 7.

6. To generate the HTML pages, simply run gem2html from its directory by writing "./gem2html" in the terminal. The HTML pages will appear in the "http-public" folder, organized the same way as the Gemtext.

7. Enjoy! Now you can point your Gemini server at the "gemini-public" directory and your HTTP server at the "http-public" directory to serve your files.


## CUSTOMIZATION
You can see that the repository has a few files besides the script. gem2html takes any gemtext files from the "gemini-public" directory, converts them to HTML and places them in the appropriate place in "http-public".

You also see a "start.html" and "end.html" file, which contains the start and end of each generated HTML document and allows you to customize the resulting HTML site. By default, they just contain the absolute basics.
You can extend these files further by adding a navigation section (in "start.html") or a footer (in "end.html") for example, the choice is yours.

As mentioned above, if you want to use CSS, you can uncomment the relevant line in the "start.html" file and create a styles.css file in this directory. This CSS file will be copied over to "html-public" by the script automatically.

If you need inspiration for customizing your site, you can take my site Regrow.Earth as an example, you can find the full source code along with the HTML files and CSS here:
https://codeberg.org/unicorn/regrow.earth

## LIMITATIONS
The script currently only handles Gemtext files ending in ".gmi", so any images or other files are ignored. I will probably change this in the future so that any other files are also copied over, but it is not yet implemented.

Due to how the awk script works, it only works properly if you leave a space after the special formatting tags that Gemtext uses, like "#" or "```". It should look like this:

``` description of preformatted text block
echo "hello"
```
* example
* list



I hope you find it useful!