当前位置: 首页>>代码示例>>C#>>正文


C# MarkdownDeep.Markdown.ProcessBlocks方法代码示例

本文整理汇总了C#中MarkdownDeep.Markdown.ProcessBlocks方法的典型用法代码示例。如果您正苦于以下问题:C# MarkdownDeep.Markdown.ProcessBlocks方法的具体用法?C# MarkdownDeep.Markdown.ProcessBlocks怎么用?C# MarkdownDeep.Markdown.ProcessBlocks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MarkdownDeep.Markdown的用法示例。


在下文中一共展示了MarkdownDeep.Markdown.ProcessBlocks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SplitUserSections

        // Split the markdown into sections, one section for each
        // top level heading
        public static List<string> SplitUserSections(string markdown)
        {
            // Build blocks
            var md = new MarkdownDeep.Markdown();
            md.UserBreaks = true;

            // Process blocks
            var blocks = md.ProcessBlocks(markdown);

            // Create sections
            var Sections = new List<string>();
            int iPrevSectionOffset = 0;
            for (int i = 0; i < blocks.Count; i++)
            {
                var b = blocks[i];
                if (b.blockType==BlockType.user_break)
                {
                    // Get the offset of the section
                    int iSectionOffset = b.lineStart;

                    // Add section
                    Sections.Add(markdown.Substring(iPrevSectionOffset, iSectionOffset - iPrevSectionOffset).Trim());

                    // Next section starts on next line
                    if (i + 1 < blocks.Count)
                    {
                        iPrevSectionOffset = blocks[i + 1].lineStart;
                        if (iPrevSectionOffset==0)
                            iPrevSectionOffset = blocks[i + 1].contentStart;
                    }
                    else
                        iPrevSectionOffset = markdown.Length;
                }
            }

            // Add the last section
            if (markdown.Length > iPrevSectionOffset)
            {
                Sections.Add(markdown.Substring(iPrevSectionOffset).Trim());
            }

            return Sections;
        }
开发者ID:Daegalus,项目名称:markdowndeep-wp7,代码行数:45,代码来源:MardownDeep.cs

示例2: SplitSections

        // Split the markdown into sections, one section for each
        // top level heading
        public static List<string> SplitSections(string markdown)
        {
            // Build blocks
            var md = new MarkdownDeep.Markdown();

            // Process blocks
            var blocks = md.ProcessBlocks(markdown);

            // Create sections
            var Sections = new List<string>();
            int iPrevSectionOffset = 0;
            for (int i = 0; i < blocks.Count; i++)
            {
                var b = blocks[i];
                if (md.IsSectionHeader(b))
                {
                    // Get the offset of the section
                    int iSectionOffset = b.lineStart;

                    // Add section
                    Sections.Add(markdown.Substring(iPrevSectionOffset, iSectionOffset - iPrevSectionOffset));

                    iPrevSectionOffset = iSectionOffset;
                }
            }

            // Add the last section
            if (markdown.Length > iPrevSectionOffset)
            {
                Sections.Add(markdown.Substring(iPrevSectionOffset));
            }

            return Sections;
        }
开发者ID:Daegalus,项目名称:markdowndeep-wp7,代码行数:36,代码来源:MardownDeep.cs


注:本文中的MarkdownDeep.Markdown.ProcessBlocks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。