aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Johnson <nick@nicksphere.ch>2022-02-19 00:00:00 +0000
committerNicholas Johnson <nick@nicksphere.ch>2022-02-19 00:00:00 +0000
commitf468b0e284487fcd515be404a174f6a40fe44cfaf4a2c625950ee81e4a735d2a (patch)
treeed19ab03020daacce7deced1c37597d4e10cf90287508e0bc1c5fc699a257cf5
parent97715dbef6a054d6c92f845c318883ce532ca5d11b1d73d189d0e404651c29df (diff)
Wrap a tag in p tag so it shows up on new line
-rw-r--r--src/gemini2html.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gemini2html.c b/src/gemini2html.c
index 0fd5da6..5a179bb 100644
--- a/src/gemini2html.c
+++ b/src/gemini2html.c
@@ -191,8 +191,8 @@ char* convert_pre_toggle_line(const char* line, const size_t len) {
* If no link text is provided, the href is used as the link text.
*
* Examples:
- * convert_link_line("=> https://google.com Goolag ") => "<a rel=\"noreferrer noopener\" href=\"https://google.com\"">Goolag </a>\n"
- * convert_link_line("=> https://google.com") => "<a rel=\"noreferrer noopener\" href=\"https://google.com\"">https://google.com</a>\n"
+ * convert_link_line("=> https://google.com Goolag ") => "<p><a rel=\"noreferrer noopener\" href=\"https://google.com\"">Goolag </a></p>\n"
+ * convert_link_line("=> https://google.com") => "<p><a rel=\"noreferrer noopener\" href=\"https://google.com\"">https://google.com</a></p>\n"
*/
char* convert_link_line(const char* line, const size_t len) {
/* skip whitespace before href */
@@ -207,7 +207,7 @@ char* convert_link_line(const char* line, const size_t len) {
size_t before_link_text = after_href;
skip_whitespace(line, &before_link_text);
- char* escaped_href = escape_text_add_tags("<a href=\"", line + before_href, "\">", after_href - before_href);
+ char* escaped_href = escape_text_add_tags("<p><a href=\"", line + before_href, "\">", after_href - before_href);
/* escaped_href will be appended to, so remove newline */
escaped_href[strlen(escaped_href) - 1] = '\0';
@@ -216,10 +216,10 @@ char* convert_link_line(const char* line, const size_t len) {
/* if no link text exists, use the href as link text */
if (line[before_link_text] == '\0') {
- escaped_with_tags = escape_text_add_tags(escaped_href, line + before_href, "</a>", after_href - before_href);
+ escaped_with_tags = escape_text_add_tags(escaped_href, line + before_href, "</a></p>", after_href - before_href);
/* otherwise use the link text */
} else {
- escaped_with_tags = escape_text_add_tags(escaped_href, line + before_link_text, "</a>", len - before_link_text);
+ escaped_with_tags = escape_text_add_tags(escaped_href, line + before_link_text, "</a></p>", len - before_link_text);
}
/* escaped_href is no longer needed */