diff options
author | Nicholas Johnson <nick@nicksphere.ch> | 2022-03-03 00:00:00 +0000 |
---|---|---|
committer | Nicholas Johnson <nick@nicksphere.ch> | 2022-03-03 00:00:00 +0000 |
commit | 5f6c35c9a078f6bc7e6085e94fdbe2626a5fe17980603ed5b73507d74865ea74 (patch) | |
tree | 1d1029ba7898b30c287593e1a68dabc353d499652d55769bd9c29ef8499efb66 | |
parent | f468b0e284487fcd515be404a174f6a40fe44cfaf4a2c625950ee81e4a735d2a (diff) |
Add rel="noreferrer" to a tag
-rw-r--r-- | gemini2html.1 | 2 | ||||
-rw-r--r-- | src/gemini2html.c | 9 | ||||
-rw-r--r-- | src/main.c | 4 |
3 files changed, 8 insertions, 7 deletions
diff --git a/gemini2html.1 b/gemini2html.1 index f0773e7..b9b74a3 100644 --- a/gemini2html.1 +++ b/gemini2html.1 @@ -1,4 +1,4 @@ -.TH GEMINI2HTML "1" "January 2022" "gemini2html v1.2.1" +.TH GEMINI2HTML "1" "January 2022" "gemini2html v1.3.1" .SH NAME gemini2html \- convert gemini text to HTML .SH SYNOPSIS diff --git a/src/gemini2html.c b/src/gemini2html.c index 5a179bb..29c9581 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 ") => "<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" + * convert_link_line("=> https://google.com Goolag ") => "<p><a rel=\"noreferrer\" href=\"https://google.com\"">Goolag </a></p>\n" + * convert_link_line("=> https://google.com") => "<p><a rel=\"noreferrer\" 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,8 @@ 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("<p><a href=\"", line + before_href, "\">", after_href - before_href); + char* escaped_href = escape_text_add_tags("<p><a href=\"", line + before_href, "\" rel=\"noreferrer\">", + after_href - before_href); /* escaped_href will be appended to, so remove newline */ escaped_href[strlen(escaped_href) - 1] = '\0'; @@ -376,4 +377,4 @@ int gmi_to_html(FILE* fp_gmi, FILE* fp_html) { } return 0; -}
\ No newline at end of file +} @@ -23,7 +23,7 @@ #include "gemini2html.h" -#define VERSION "1.2.1" +#define VERSION "1.3.1" /* displays the help menu */ void display_help_text(char* prog) { @@ -69,4 +69,4 @@ int main(int argc, char* argv[]) { if (gmi_to_html(stdin, stdout) == -1) return -1; else return 0; -}
\ No newline at end of file +} |