2018-06-18 23:24:34 -07:00
|
|
|
|
// Copyright (c) 2016-2017 Nicolas Musset. All rights reserved.
|
|
|
|
|
|
// This file is licensed under the MIT license.
|
|
|
|
|
|
// See the LICENSE.md file in the project root for more information.
|
|
|
|
|
|
|
|
|
|
|
|
using Markdig.Syntax.Inlines;
|
|
|
|
|
|
using MatterHackers.Agg.UI;
|
2019-06-04 11:00:57 -07:00
|
|
|
|
using MatterHackers.MatterControl;
|
2018-06-18 23:24:34 -07:00
|
|
|
|
|
|
|
|
|
|
namespace Markdig.Renderers.Agg.Inlines
|
|
|
|
|
|
{
|
2019-06-04 11:00:57 -07:00
|
|
|
|
public class CodeInlineX : FlowLayoutWidget
|
|
|
|
|
|
{
|
|
|
|
|
|
private ThemeConfig theme;
|
|
|
|
|
|
|
|
|
|
|
|
public CodeInlineX(ThemeConfig theme)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.theme = theme;
|
|
|
|
|
|
this.HAnchor = HAnchor.Fit;
|
|
|
|
|
|
this.VAnchor = VAnchor.Fit;
|
|
|
|
|
|
this.Padding = 4;
|
|
|
|
|
|
this.BackgroundColor = theme.MinimalShade;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-06-05 12:16:37 -07:00
|
|
|
|
public override GuiWidget AddChild(GuiWidget childToAdd, int indexInChildrenList = -1)
|
2019-06-04 11:00:57 -07:00
|
|
|
|
{
|
2020-06-05 12:16:37 -07:00
|
|
|
|
return base.AddChild(childToAdd, indexInChildrenList);
|
2019-06-04 11:00:57 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-06-18 23:24:34 -07:00
|
|
|
|
|
|
|
|
|
|
public class AggCodeInlineRenderer : AggObjectRenderer<CodeInline>
|
|
|
|
|
|
{
|
2019-06-04 11:00:57 -07:00
|
|
|
|
private ThemeConfig theme;
|
|
|
|
|
|
|
|
|
|
|
|
public AggCodeInlineRenderer(ThemeConfig theme)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.theme = theme;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-06-18 23:24:34 -07:00
|
|
|
|
protected override void Write(AggRenderer renderer, CodeInline obj)
|
|
|
|
|
|
{
|
|
|
|
|
|
//var run = new Run(obj.Content);
|
|
|
|
|
|
//run.SetResourceReference(FrameworkContentElement.StyleProperty, Styles.CodeStyleKey);
|
|
|
|
|
|
|
2019-06-04 11:00:57 -07:00
|
|
|
|
//renderer.WriteInline(new CodeInlineX());
|
|
|
|
|
|
renderer.Push(new CodeInlineX(theme));
|
|
|
|
|
|
renderer.WriteText(obj.Content);
|
|
|
|
|
|
renderer.Pop();
|
2018-06-18 23:24:34 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|