You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This makes the renderer print the content of informational
HTML tags while stripping the tags themselves.
Tags like script, iframe, style, etc, which are unlikely to
ever hold presentable content, are exempt from this, and
their content is skipped from rendering as well as the tags
themselves.
<br>, a hard-break tag, is supported as a Markdown
hard-break replacement (the two spaces before newline).
This also adds tests for this behavior inside general_text.md.
Fixes#6, a longstanding issue with inline HTML in
blockquotes.
Copy file name to clipboardExpand all lines: testdata/general_text.gmi
+43-6Lines changed: 43 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,10 @@ Single newlines (like in this multi-line paragraph) will get replaced by a space
6
6
7
7
Inline formatting bits (like this **bold** text, *emphasized* text, ~~strikethrough~~ text, `preformatted text`) are kept to make sure Gemini readers still have the stylistic context of your text.
8
8
9
+
Adding two spaces at the end of a line will insert a hard
10
+
break. You can also create a hard break using a backslash at the end
11
+
of a line. Hard breaks at the end of a paragraph are ignored.
12
+
9
13
## Blockquotes
10
14
11
15
Newlines in blockquote paragraphs, unlike usual paragraphs, aren't replaced with a space. This facilitates appending authorship information to the quote, or using blockquotes to write poems.
@@ -22,6 +26,9 @@ Newlines in blockquote paragraphs, unlike usual paragraphs, aren't replaced with
22
26
23
27
> — also Timur Demin, in the process of writing this test file
24
28
29
+
> Hard breaks are also supported in blockquotes,
30
+
> for compatibility. Hard breaks at the end of a blockquote are ignored.
31
+
25
32
## Code
26
33
27
34
gmnhg will use Gemtext preformatted blocks for that. Markdown alt-text for preformatted blocks is supported, and is used to render alt-text as specified by Gemini spec p. 5.4.3.
@@ -74,15 +81,45 @@ Since clients like Lagrange treat the fourth and the rest of #-s as heading cont
74
81
75
82
###### Heading 6
76
83
77
-
## Misc
84
+
## HTML
85
+
86
+
Inline HTML is currently stripped, but HTML contents remain on-screen. This may change in the future. HTML tags can be escaped with \ as in <span></span> or enclosed with ``.
87
+
88
+
HTML tags are stripped from HTML blocks. (Note that HTML blocks must begin and end with a supported HTML block tag, and must have blank lines before and after the block.)
89
+
90
+
### Break tags
91
+
92
+
Hard breaks
93
+
using <br> are supported.
94
+
95
+
Hard breaks using <br> are supported
96
+
inside HTML blocks.
97
+
98
+
### HTML entities
78
99
79
-
Inline HTML is currently stripped, but HTML contents remain on-screen. This may change in the future.
100
+
HTML escaped entities like & and < are unescaped, even when they show up inside an inline HTML section. Escaping them with a leading backslash is possible outside of HTML blocks: &, <. Any escaped characters inside a code span (such as `< or >`) will not be unescaped.
80
101
81
-
> There's currently a bug in gmnhg which prevents it from
82
-
> stripping HTML in certain scenarios. HTML is noticeably still present
83
-
> inside <span>blockquotes</span>.
102
+
HTML escaped entities like < and > are also unescaped inside HTML blocks. Backslash escapes have no effect: \&.
84
103
85
-
=> https://github.com/tdemin/gmnhg/issues/6 bug in gmnhg
104
+
### Forbidden tags
105
+
106
+
Tags that are unable to output Gemini-compatible text are completely removed from the output.
107
+
108
+
Note that the contents of "forbidden" tags will be rendered if they are placed inline, although the tags themselves will be stripped. Placing HTML block elements inline in this manner violates the spec of common Markdown flavors, but gmnhg handles it the best it can.
109
+
110
+
### HTML in blockquotes
111
+
112
+
> HTML spans are stripped from
113
+
> inside blockquotes.
114
+
115
+
> Non HTML block text before the block.
116
+
> HTML blocks are stripped from inside blockquotes.
0 commit comments