MarkdownDeep.Markdown.ProcessBlocks C# (CSharp) Method

ProcessBlocks() private method

private ProcessBlocks ( string str ) : List
str string
return List
        internal List<Block> ProcessBlocks(string str)
        {
            // Reset the list of link definitions
            m_LinkDefinitions.Clear();
            m_Footnotes.Clear();
            m_UsedFootnotes.Clear();
            m_UsedHeaderIDs.Clear();
            m_AbbreviationMap = null;
            m_AbbreviationList = null;

            // Process blocks
            return new BlockProcessor(this, MarkdownInHtml).Process(str);
        }

Usage Example

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

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

            // Create sections
            var sections      = new List <string>();
            var sectionOffset = 0;

            foreach (var b in blocks)
            {
                if (!md.IsSectionHeader(b))
                {
                    continue;
                }
                // Get the offset of the section
                var iSectionOffset = b.LineStart;

                // Add section
                sections.Add(markdown.Substring(sectionOffset, iSectionOffset - sectionOffset));

                sectionOffset = iSectionOffset;
            }

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

            return(sections);
        }
All Usage Examples Of MarkdownDeep.Markdown::ProcessBlocks