From 15be1936028a110d49f44bae5ce70fc4bd301d7f Mon Sep 17 00:00:00 2001 From: TudbuT Date: Tue, 25 Jan 2022 22:15:35 +0100 Subject: [PATCH 1/2] add image support --- views/post.ejs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/views/post.ejs b/views/post.ejs index 79f08fd..70da396 100644 --- a/views/post.ejs +++ b/views/post.ejs @@ -91,6 +91,14 @@ block { display: block; } + + img { + display: block; + margin: auto; + margin-top: 10px; + margin-bottom: 10px; + max-width: 90%; + } @@ -108,7 +116,8 @@ ret += `
${date ? (`
${date.toUTCString()}
`) : ''}

${post.author.replaceAll('<','<').replaceAll('>','>')}: ${post.title.replaceAll('<','<').replaceAll('>','>')}

` + post.content.replaceAll('<','<').replaceAll('>','>') - .replaceAll(/(https?:\/\/[^ \n]+)/g, '$1') + .replaceAll(/\[[#] ([^"]*?) [#]\]/g, '') + .replaceAll(/(?$1') .replaceAll(/\[[*] ([\w\W]*?) [*]\]/g, '$1') .replaceAll(/\[[*][*] ([\w\W]*?) [*][*]\]/g, '$1') .replaceAll(/\[[*][*][*] ([\w\W]*?) [*][*][*]\]/g, '$1') From e63c5107e4fc2c4f66fdd0919922978ff16f8255 Mon Sep 17 00:00:00 2001 From: TudbuT Date: Tue, 25 Jan 2022 22:16:28 +0100 Subject: [PATCH 2/2] add info about images to main post --- posts.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/posts.json b/posts.json index c832528..5675b5c 100644 --- a/posts.json +++ b/posts.json @@ -1,7 +1,7 @@ [ { "title": "Default post", - "content": "This is the first post, it was here since the beginning.\n\n\n(Remove the space after the '[' and before the ']')\n\n [ * [* text *] * ] [ ** [** text **] ** ] [ *** [*** text ***] *** ] [ _ [_ text _] _ ] [ *_ [*_ text _*] _* ] [ **_ [**_ text _**] _** ] [ ***_ [***_ text _***] _*** ] [ \" [\" text \"] \" ]", + "content": "This is the first post, it was here since the beginning.\n\n\n(Remove the space after the '[' and before the ']')\n\n [ * [* text *] * ] [ ** [** text **] ** ] [ *** [*** text ***] *** ] [ _ [_ text _] _ ] [ *_ [*_ text _*] _* ] [ **_ [**_ text _**] _** ] [ ***_ [***_ text _***] _*** ] [ \" [\" text \"] \" ] [ # image link # ]", "author": "root", "comments": [ {