Skip to content

Gemtext support #6747

Closed
Closed
@sburris0

Description

@sburris0

The Gemini protocol uses a markup language that is more or less a very trimmed down version of markdown.

Here is the syntax from the cheatsheet at gemini://gemini.circumlunar.space/docs/cheatsheet.gmi (Gemini client needed)

Gemtext cheatsheet

Here's the basics of how text works in Gemtext:

Long lines get wrapped by the client to fit the screen
Short lines *don't* get joined together
Write paragraphs as single long lines
Blank lines are rendered verbatim

You get three levels of heading:

# Heading

## Sub-heading

### Sub-subheading

You get one kind of list and you can't nest them:

* Mercury
* Gemini
* Apollo

Here's a quote from Maciej Cegล‚owski:

> I contend that text-based websites should not exceed in size the major works of Russian literature.

Lines which start with ``` will cause clients to toggle in and out of ordinary rendering mode and preformatted mode.  In preformatted mode, Gemtext syntax is ignored so links etc. will not be rendered, and text will appear in a monospace font.

I really like the idea of the Gemini project, but as it is new there is a lack of content.
Easy conversion from markdown (or whatever) -> gemtext will make it possible to mirror content, something I am looking to do myself.

Activity

makew0rld

makew0rld commented on Oct 28, 2020

@makew0rld

Converting from markdown to gemtext requires making some decisions about features that don't exist in gemtext. Ideally these decisions would be offered to the user as options, but I'm not sure how willing the pandoc project will be to create more command line flags just for this one format.

The main example of something that is not clear cut is inline links. Gemtext doesn't support them, but most document/markup formats do. How should they be handled?

This is something I have had to deal with for md2gemini. I've outlined the different options available for converting inline links on the README, in the link modes section. I hope this is useful to whoever ends up implementing this writer, and that my tool can suffice for some people in the meantime.

sburris0

sburris0 commented on Oct 28, 2020

@sburris0
Author

Yeah, I did start trying to make my own converter in Rust. I found there isn't an obvious way to "correctly" handle a few things.
For example, I had a function to sort of just normalize/round all of the header levels to a set that would work, e.g. it yields a hashmap {2:1, 3:2, 4:2, 5:3} if the header levels 2-5 are used in a document.

I'll likely keep working on it a bit but it's clear that starting with a config system to determine how to handle several things is a good first step.

makew0rld

makew0rld commented on Oct 28, 2020

@makew0rld

Yeah, header levels is another good point. In md2gemini I just leave higher level headers as is, so level 4 would appear as #### text and just not be valid gemtext, but still be somewhat understandable.

I would appreciate getting a link to your converter! You should also send it to the mailing list for other people to check out.

davidmrt98

davidmrt98 commented on Nov 12, 2020

@davidmrt98
Contributor

I would also like to see pandoc having Gemtext support - can I have a try at implementing the Writer?

jgm

jgm commented on Nov 12, 2020

@jgm
Owner

I think gemini might not have enough adoption yet for a regular pandoc writer. I'd suggest creating a custom lua writer. (If in the future we wanted a regular writer, this work wouldn't be wasted.)

makew0rld

makew0rld commented on Nov 19, 2020

@makew0rld

For now, I find connecting pandoc and md2gemini to work decently.

pandoc your_document.docx -t markdown | md2gemini
toastal

toastal commented on Jun 9, 2021

@toastal

I think Gemini might not have enough adoption yet for a regular Pandoc writer

Won't there always be a chicken-egg situation here? Less people bother converting to Gemtext because Pandoc doesn't support it? If it were as easy as Pandoc -> HTML followed by Pandoc -> Gemtext, I think you'd see more people putting it in the build pipeline for their blogs and docs.

alerque

alerque commented on Jun 9, 2021

@alerque
Contributor

Won't there always be a chicken-egg situation here?

Yes, there will. That's a valid point, but think about the converse proposition for a second. If picking technologies we think should thrive and favoring those implementations were the driving force behind Pandoc, what would be to stop us from removing DOCX support, or for that matter removing all formats except Common Mark, SILE, and org-mode? Surely those are the three best formats for general prose content, typeset rendering, and interlinked personal wiki respectively. Web browsers should just render from CommonMark?

I jest โ€” mostly. The point is exaggerated, but the point that picking implementations based on advocacy for a technology that isn't widely used rather than extant usage would completely reshape not just the current feature set but the actual utility (or lack thereof) and contributor pool (or shallowness thereof).

tarleb

tarleb commented on Jun 9, 2021

@tarleb
Collaborator

See also: #7353 (comment)

toastal

toastal commented on Jun 9, 2021

@toastal

That's fair. Is there specific "bar" that needs to be met and is it documented? It seems this sort of request probably comes up a lot then for every sort of document language that wants to get adoption.

Where Gemini+Gemtext caught my eye is that SourceHut supports it natively for their 'Pages' which is a small endorsement (though unclear if it's for them or publishing for users, SourceHut's main maintainer says there will be more support in the future), but I would then assume that that doesn't count as a making the cut. This said, it appears there are a fairly large set of non-Pandoc tools for moving between some formats for now, like what was posted in a previous comment.

alerque

alerque commented on Jun 10, 2021

@alerque
Contributor

No I don't think there is an exact bar for this. Somebody interested in it that is willing to contribute the Haskell code to make it happen is probably the biggest factor, bonus points for prior activity in Pandoc development. A developer that wants to contribute something counts for more than a lot of people wanting it but needing somebody else to code it up for them. After that the availability of solid specs and other open source tooling makes a big difference. Finally of course lots of different people requesting/upvoting the same thing eventually gets more notice than one squeaky wheel.

xplosionmind

xplosionmind commented on Apr 5, 2022

@xplosionmind

Hi! Has this discussion been completely dropped or there is a chance for Pandoc to support importing and exporting from/to Gemtext?

I believe it would be extremely useful.

tarleb

tarleb commented on Apr 5, 2022

@tarleb
Collaborator

I think this still holds true: #6747 (comment).
Note that pandoc now supports custom readers, so support for reading and writing could be added by doing a bit of Lua coding.

Wandmalfarbe

Wandmalfarbe commented on Feb 1, 2025

@Wandmalfarbe
SponsorContributor

I found a pandoc filter that can convert to gemtext https://github.com/kr1sp1n/gemini-pandoc-lua-filter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

      Participants

      @jgm@mb21@alerque@tarleb@toastal

      Issue actions

        Gemtext support ยท Issue #6747 ยท jgm/pandoc