mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-23 19:26:57 -04:00
parent
cd042e5368
commit
d88cd9b228
6 changed files with 39 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using DiscordChatExporter.Core.Markdown.Internal;
|
using DiscordChatExporter.Core.Markdown.Internal;
|
||||||
|
@ -57,6 +57,18 @@ namespace DiscordChatExporter.Core.Markdown
|
||||||
new Regex("\\|\\|(.+?)\\|\\|", DefaultRegexOptions | RegexOptions.Singleline),
|
new Regex("\\|\\|(.+?)\\|\\|", DefaultRegexOptions | RegexOptions.Singleline),
|
||||||
(p, m) => new FormattedNode(TextFormatting.Spoiler, Parse(p.Shrink(m.Groups[1]))));
|
(p, m) => new FormattedNode(TextFormatting.Spoiler, Parse(p.Shrink(m.Groups[1]))));
|
||||||
|
|
||||||
|
// Capture any character until the end of the line
|
||||||
|
// Opening 'greater than' character must be followed by whitespace
|
||||||
|
private static readonly IMatcher<Node> SingleLineQuoteNodeMatcher = new RegexMatcher<Node>(
|
||||||
|
new Regex("^>\\s(.+)\r?\n?", DefaultRegexOptions),
|
||||||
|
(p, m) => new FormattedNode(TextFormatting.Quote, Parse(p.Shrink(m.Groups[1]))));
|
||||||
|
|
||||||
|
// Capture any character until the end of the input
|
||||||
|
// Opening 'greater than' characters must be followed by whitespace
|
||||||
|
private static readonly IMatcher<Node> MultiLineQuoteNodeMatcher = new RegexMatcher<Node>(
|
||||||
|
new Regex("^>>>\\s(.+)", DefaultRegexOptions | RegexOptions.Singleline),
|
||||||
|
(p, m) => new FormattedNode(TextFormatting.Quote, Parse(p.Shrink(m.Groups[1]))));
|
||||||
|
|
||||||
/* Code blocks */
|
/* Code blocks */
|
||||||
|
|
||||||
// Capture any character except backtick until a backtick
|
// Capture any character except backtick until a backtick
|
||||||
|
@ -176,6 +188,8 @@ namespace DiscordChatExporter.Core.Markdown
|
||||||
ItalicAltFormattedNodeMatcher,
|
ItalicAltFormattedNodeMatcher,
|
||||||
StrikethroughFormattedNodeMatcher,
|
StrikethroughFormattedNodeMatcher,
|
||||||
SpoilerFormattedNodeMatcher,
|
SpoilerFormattedNodeMatcher,
|
||||||
|
MultiLineQuoteNodeMatcher,
|
||||||
|
SingleLineQuoteNodeMatcher,
|
||||||
|
|
||||||
// Code blocks
|
// Code blocks
|
||||||
MultiLineCodeBlockNodeMatcher,
|
MultiLineCodeBlockNodeMatcher,
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
Italic,
|
Italic,
|
||||||
Underline,
|
Underline,
|
||||||
Strikethrough,
|
Strikethrough,
|
||||||
Spoiler
|
Spoiler,
|
||||||
|
Quote
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -81,6 +81,10 @@ namespace DiscordChatExporter.Core.Rendering
|
||||||
// Spoiler
|
// Spoiler
|
||||||
if (formattedNode.Formatting == TextFormatting.Spoiler)
|
if (formattedNode.Formatting == TextFormatting.Spoiler)
|
||||||
return $"<span class=\"spoiler\">{innerHtml}</span>";
|
return $"<span class=\"spoiler\">{innerHtml}</span>";
|
||||||
|
|
||||||
|
// Quote
|
||||||
|
if (formattedNode.Formatting == TextFormatting.Quote)
|
||||||
|
return $"<div class=\"quote\">{innerHtml}</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inline code block node
|
// Inline code block node
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* === GENERAL === */
|
/* === GENERAL === */
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: #36393e;
|
background-color: #36393e;
|
||||||
|
@ -13,6 +13,10 @@ a {
|
||||||
background-color: rgba(255, 255, 255, 0.1);
|
background-color: rgba(255, 255, 255, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.quote {
|
||||||
|
border-color: #4f545c;
|
||||||
|
}
|
||||||
|
|
||||||
.pre {
|
.pre {
|
||||||
background-color: #2f3136 !important;
|
background-color: #2f3136 !important;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* === GENERAL === */
|
/* === GENERAL === */
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
|
@ -14,6 +14,10 @@ a {
|
||||||
background-color: rgba(0, 0, 0, 0.1);
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.quote {
|
||||||
|
border-color: #c7ccd1;
|
||||||
|
}
|
||||||
|
|
||||||
.pre {
|
.pre {
|
||||||
background-color: #f9f9f9 !important;
|
background-color: #f9f9f9 !important;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,13 @@ img {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.quote {
|
||||||
|
border-left: 4px solid;
|
||||||
|
border-radius: 3px;
|
||||||
|
margin: 8px 0;
|
||||||
|
padding-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.pre {
|
.pre {
|
||||||
font-family: "Consolas", "Courier New", Courier, monospace;
|
font-family: "Consolas", "Courier New", Courier, monospace;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue