A class used to represent abstract markdown.
상속: MarkdownBlock
        protected void AssertEqual(string markdown, params MarkdownBlock[] expectedAst)
        {
            var expected = new StringBuilder();
            foreach (var block in expectedAst)
            {
                SerializeElement(expected, block, indentLevel: 0);
            }

            var parser = new MarkdownDocument();
            parser.Parse(markdown);

            var actual = new StringBuilder();
            foreach (var block in parser.Blocks)
            {
                SerializeElement(actual, block, indentLevel: 0);
            }

            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
 public XamlRenderer(MarkdownDocument document, ILinkRegister linkRegister)
 {
     this.document = document;
     this.linkRegister = linkRegister;
 }
        /// <summary>
        /// Fired when the value of a DependencyProperty is changed.
        /// </summary>
        /// <param name="d"></param>
        /// <param name="prop"></param>
        private void OnPropertyChanged(DependencyObject d, DependencyProperty prop)
        {
            // Make sure we have something to parse.
            if (Markdown == null)
                return;

            // Disconnect from OnClick handlers.
            UnhookListeners();

            var args = new OnMarkdownReadyArgs();
            try
            {
                // Try to parse the markdown.
                MarkdownDocument markdown = new MarkdownDocument();
                markdown.Parse(Markdown);

                // Now try to display it
                var renderer = new XamlRenderer(markdown, this);
                renderer.Background = Background;
                renderer.BorderBrush = BorderBrush;
                renderer.BorderThickness = BorderThickness;
                renderer.CharacterSpacing = CharacterSpacing;
                renderer.FontFamily = FontFamily;
                renderer.FontSize = FontSize;
                renderer.FontStretch = FontStretch;
                renderer.FontStyle = FontStyle;
                renderer.FontWeight = FontWeight;
                renderer.Foreground = Foreground;
                renderer.IsTextSelectionEnabled = IsTextSelectionEnabled;
                renderer.Padding = Padding;
                renderer.CodeBackground = CodeBackground;
                renderer.CodeBorderBrush = CodeBorderBrush;
                renderer.CodeBorderThickness = CodeBorderThickness;
                renderer.CodeForeground = CodeForeground;
                renderer.CodeFontFamily = CodeFontFamily;
                renderer.CodePadding = CodePadding;
                renderer.CodeMargin = CodeMargin;
                renderer.Header1FontSize = Header1FontSize;
                renderer.Header1FontWeight = Header1FontWeight;
                renderer.Header1Margin = Header1Margin;
                renderer.Header2FontSize = Header2FontSize;
                renderer.Header2FontWeight = Header2FontWeight;
                renderer.Header2Margin = Header2Margin;
                renderer.Header3FontSize = Header3FontSize;
                renderer.Header3FontWeight = Header3FontWeight;
                renderer.Header3Margin = Header3Margin;
                renderer.Header4FontSize = Header4FontSize;
                renderer.Header4FontWeight = Header4FontWeight;
                renderer.Header4Margin = Header4Margin;
                renderer.Header5FontSize = Header5FontSize;
                renderer.Header5FontWeight = Header5FontWeight;
                renderer.Header5Margin = Header5Margin;
                renderer.Header6FontSize = Header6FontSize;
                renderer.Header6FontWeight = Header6FontWeight;
                renderer.Header6Margin = Header6Margin;
                renderer.HorizontalRuleBrush = HorizontalRuleBrush;
                renderer.HorizontalRuleMargin = HorizontalRuleMargin;
                renderer.HorizontalRuleThickness = HorizontalRuleThickness;
                renderer.ListMargin = ListMargin;
                renderer.ListGutterWidth = ListGutterWidth;
                renderer.ListBulletSpacing = ListBulletSpacing;
                renderer.ParagraphMargin = ParagraphMargin;
                renderer.QuoteBackground = QuoteBackground;
                renderer.QuoteBorderBrush = QuoteBorderBrush;
                renderer.QuoteBorderThickness = QuoteBorderThickness;
                renderer.QuoteForeground = QuoteForeground;
                renderer.QuoteMargin = QuoteMargin;
                renderer.QuotePadding = QuotePadding;
                renderer.TableBorderBrush = TableBorderBrush;
                renderer.TableBorderThickness = TableBorderThickness;
                renderer.TableCellPadding = TableCellPadding;
                renderer.TableMargin = TableMargin;
                renderer.TextWrapping = TextWrapping;
                Content = renderer.Render();
            }
            catch (Exception ex)
            {
                DebuggingReporter.ReportCriticalError("Error while parsing and rendering: " + ex.Message);
                args.WasError = true;
                args.Exception = ex;
            }

            // #todo indicate if ready
            m_onMarkdownReady.Raise(this, args);
        }