mirror of https://github.com/ppy/osu
add inline code colour
Reference : 31579d45aa/resources/assets/less/bem/osu-md.less (L12-L17)
This commit is contained in:
parent
fc4fa4f696
commit
88aaa9b332
|
@ -59,6 +59,15 @@ public void TestLinkWithInlineText()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestInlineCode()
|
||||||
|
{
|
||||||
|
AddStep("Add inline code", () =>
|
||||||
|
{
|
||||||
|
markdownContainer.Text = "This is `inline code` text";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestFencedCodeBlock()
|
public void TestFencedCodeBlock()
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,13 +2,22 @@
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using Markdig.Syntax.Inlines;
|
using Markdig.Syntax.Inlines;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.Containers.Markdown;
|
using osu.Framework.Graphics.Containers.Markdown;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Containers.Markdown
|
namespace osu.Game.Graphics.Containers.Markdown
|
||||||
{
|
{
|
||||||
public class OsuMarkdownTextFlowContainer : MarkdownTextFlowContainer
|
public class OsuMarkdownTextFlowContainer : MarkdownTextFlowContainer
|
||||||
{
|
{
|
||||||
|
[Resolved]
|
||||||
|
private OverlayColourProvider colourProvider { get; set; }
|
||||||
|
|
||||||
protected override void AddLinkText(string text, LinkInline linkInline)
|
protected override void AddLinkText(string text, LinkInline linkInline)
|
||||||
=> AddDrawable(new OsuMarkdownLinkText(text, 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; });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue