1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 06:28:35 +01:00

finished up UiMarkdownParser

This commit is contained in:
Ell 2022-06-14 00:04:57 +02:00
parent 7b1da2f1a7
commit 01fb5288ff

View file

@ -59,6 +59,7 @@ namespace MLEM.Ui.Parsers {
public UiMarkdownParser(bool applyDefaultStyling = true) { public UiMarkdownParser(bool applyDefaultStyling = true) {
if (applyDefaultStyling) { if (applyDefaultStyling) {
this.CodeFont = "Monospaced"; this.CodeFont = "Monospaced";
this.Style<VerticalSpace>(ElementType.VerticalSpace, v => v.Size = new Vector2(1, 5));
for (var i = 0; i < 6; i++) { for (var i = 0; i < 6; i++) {
var level = i; var level = i;
this.Style<Paragraph>(ElementTypes[Array.IndexOf(ElementTypes, ElementType.Header1) + i], p => { this.Style<Paragraph>(ElementTypes[Array.IndexOf(ElementTypes, ElementType.Header1) + i], p => {
@ -138,13 +139,13 @@ namespace MLEM.Ui.Parsers {
// quotes // quotes
if (line.StartsWith(">")) { if (line.StartsWith(">")) {
yield return (ElementType.Quote, new Paragraph(Anchor.AutoLeft, 1, line.Substring(1).Trim())); yield return (ElementType.Blockquote, new Paragraph(Anchor.AutoLeft, 1, line.Substring(1).Trim()));
continue; continue;
} }
// vertical space (empty lines) // vertical space (empty lines)
if (line.Trim().Length <= 0) { if (line.Trim().Length <= 0) {
yield return (ElementType.VerticalSpace, new VerticalSpace(4)); yield return (ElementType.VerticalSpace, new VerticalSpace(0));
continue; continue;
} }
@ -229,7 +230,7 @@ namespace MLEM.Ui.Parsers {
/// A blockquote. /// A blockquote.
/// This element type is a <see cref="Paragraph"/>. /// This element type is a <see cref="Paragraph"/>.
/// </summary> /// </summary>
Quote = 1, Blockquote = 1,
/// <summary> /// <summary>
/// A vertical space, which is a gap between multiple markdown paragraphs. /// A vertical space, which is a gap between multiple markdown paragraphs.
/// This element type is a <see cref="VerticalSpace"/>. /// This element type is a <see cref="VerticalSpace"/>.