Skip to content

Commit

Permalink
Susimail: Add markdown js for plain text content
Browse files Browse the repository at this point in the history
  • Loading branch information
zzz committed Jan 10, 2024
1 parent 3995078 commit e25ce7f
Show file tree
Hide file tree
Showing 7 changed files with 1,696 additions and 0 deletions.
7 changes: 7 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,13 @@ Applications:
GPLv2 (or any later version)
See licenses/LICENSE-GPLv2.txt

SusiMail Pagedown:
Original Markdown Copyright (c) 2004-2005 John Gruber
Original Showdown code copyright (c) 2007 John Fraser
Modifications and bugfixes (c) 2009 Dana Robinson
Modifications and bugfixes (c) 2009-2014 Stack Exchange Inc.
See licenses/LICENSE-pagedown.txt

Systray (systray.jar):
Public domain.

Expand Down
1,623 changes: 1,623 additions & 0 deletions apps/susimail/src/js/Markdown.Converter.js

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions apps/susimail/src/js/markdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* @license http://www.gnu.org/licenses/gpl-2.0.html GPL-2.0 */
/* see also licenses/LICENSE-GPLv2.txt */

function initMarkdown() {
var mailbodies = document.getElementsByClassName("mailbody");
for(index = 0; index < mailbodies.length; index++)
{
var mailbody = mailbodies[index];
if (mailbody.nodeName === "P") {
var converter = new Markdown.Converter();
mailbody.innerHTML = converter.makeHtml(mailbody.innerHTML);
}
}
}

document.addEventListener("DOMContentLoaded", function() {
initMarkdown();
}, true);

/* @license-end */
4 changes: 4 additions & 0 deletions apps/susimail/src/src/i2p/susi/webmail/WebMail.java
Original file line number Diff line number Diff line change
Expand Up @@ -2415,6 +2415,10 @@ private void processRequest( HttpServletRequest httpRequest, HttpServletResponse
// TODO JS?
out.println("<meta http-equiv=\"refresh\" content=\"5;url=" + myself + "\">");
// TODO we don't need the form below
} else if (state == State.SHOW) {
out.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + sessionObject.themePath + "markdown.css?" + CoreVersion.VERSION + "\">");
out.println("<script src=\"/susimail/js/markdown.js?" + CoreVersion.VERSION + "\" type=\"text/javascript\"></script>");
out.println("<script src=\"/susimail/js/Markdown.Converter.js?" + CoreVersion.VERSION + "\" type=\"text/javascript\"></script>");
}
out.println("<script src=\"/susimail/js/notifications.js?" + CoreVersion.VERSION + "\" type=\"text/javascript\"></script>");
out.print("</head>\n<body>");
Expand Down
5 changes: 5 additions & 0 deletions apps/susimail/src/themes/dark/markdown.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blockquote {
border-left: 2px dotted #888;
padding-left: 5px;
background: #d0f0ff;
}
5 changes: 5 additions & 0 deletions apps/susimail/src/themes/light/markdown.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blockquote {
border-left: 2px dotted #888;
padding-left: 5px;
background: #d0f0ff;
}
32 changes: 32 additions & 0 deletions licenses/LICENSE-pagedown.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
A javascript port of Markdown, as used on Stack Overflow
and the rest of Stack Exchange network.

Largely based on showdown.js by John Fraser (Attacklab).

Original Markdown Copyright (c) 2004-2005 John Gruber
<http://daringfireball.net/projects/markdown/>


Original Showdown code copyright (c) 2007 John Fraser

Modifications and bugfixes (c) 2009 Dana Robinson
Modifications and bugfixes (c) 2009-2014 Stack Exchange Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

0 comments on commit e25ce7f

Please sign in to comment.