1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 09:27:34 +08:00

add inline code colour

Reference : 31579d45aa/resources/assets/less/bem/osu-md.less (L12-L17)
This commit is contained in:
Gagah Pangeran Rosfatiputra 2021-05-02 22:35:30 +07:00
parent fc4fa4f696
commit 88aaa9b332
No known key found for this signature in database
GPG Key ID: 25F6F17FD29031E2
2 changed files with 18 additions and 0 deletions

View File

@ -59,6 +59,15 @@ namespace osu.Game.Tests.Visual.UserInterface
});
}
[Test]
public void TestInlineCode()
{
AddStep("Add inline code", () =>
{
markdownContainer.Text = "This is `inline code` text";
});
}
[Test]
public void TestFencedCodeBlock()
{

View File

@ -2,13 +2,22 @@
// See the LICENCE file in the repository root for full licence text.
using Markdig.Syntax.Inlines;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers.Markdown;
using osu.Game.Overlays;
namespace osu.Game.Graphics.Containers.Markdown
{
public class OsuMarkdownTextFlowContainer : MarkdownTextFlowContainer
{
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
protected override void AddLinkText(string text, LinkInline linkInline)
=> AddDrawable(new OsuMarkdownLinkText(text, linkInline));
// TODO : Add background (colour B6) and change font to monospace
protected override void AddCodeInLine(CodeInline codeInline)
=> AddText(codeInline.Content, t => { t.Colour = colourProvider.Light1; });
}
}