1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 17:32:54 +08:00

add OsuMarkdownTable

This commit is contained in:
Gagah Pangeran Rosfatiputra 2021-04-28 10:53:12 +07:00
parent 2252d308c8
commit c09067c3d5
No known key found for this signature in database
GPG Key ID: 25F6F17FD29031E2
3 changed files with 35 additions and 0 deletions

View File

@ -85,5 +85,19 @@ Line below";
@"> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.";
});
}
[Test]
public void TestTable()
{
AddStep("Add Table", () =>
{
markdownContainer.Text =
@"| Left Aligned | Center Aligned | Right Aligned |
| :------------------- | :--------------------: | ---------------------:|
| Long Align Left Text | Long Align Center Text | Long Align Right Text |
| Align Left | Align Center | Align Right |
| Left | Center | Right |";
});
}
}
}

View File

@ -3,6 +3,7 @@
using Markdig;
using Markdig.Extensions.AutoIdentifiers;
using Markdig.Extensions.Tables;
using Markdig.Extensions.Yaml;
using Markdig.Syntax;
using osu.Framework.Graphics.Containers;
@ -34,6 +35,8 @@ namespace osu.Game.Graphics.Containers.Markdown
protected override MarkdownQuoteBlock CreateQuoteBlock(QuoteBlock quoteBlock) => new OsuMarkdownQuoteBlock(quoteBlock);
protected override MarkdownTable CreateTable(Table table) => new OsuMarkdownTable(table);
protected override MarkdownPipeline CreateBuilder()
=> new MarkdownPipelineBuilder().UseAutoIdentifiers(AutoIdentifierOptions.GitHub)
.UseEmojiAndSmiley()

View File

@ -0,0 +1,18 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using Markdig.Extensions.Tables;
using osu.Framework.Graphics.Containers.Markdown;
namespace osu.Game.Graphics.Containers.Markdown
{
public class OsuMarkdownTable : MarkdownTable
{
public OsuMarkdownTable(Table table)
: base(table)
{
}
protected override MarkdownTableCell CreateTableCell(TableCell cell, TableColumnDefinition definition, bool isHeading) => new OsuMarkdownTableCell(cell, definition, isHeading);
}
}