Пример #1
0
 public MdTreeBuilder(MdLine mdLine)
 {
     currentMdLine   = mdLine;
     sourceString    = mdLine.Content;
     supportedMdTags = mdLine.SupportedMdTags;
     currentMdTag    = MdLineHelper.DetermineCurrentTag(mdLine);
 }
Пример #2
0
        public List <MdLine> CreateMdLines()
        {
            MdLines = new List <MdLine>();
            MdLine currentMdLine = new TextLine();

            foreach (var line in Text)
            {
                if (MdLineHelper.IsCodeLine(line, currentMdLine))
                {
                    MdLineHelper.HandleCodeLine(ref currentMdLine, line, MdLines);
                    continue;
                }
                if (MdLineHelper.IsOrderedListLine(line))
                {
                    MdLineHelper.HandleOrderedListLine(ref currentMdLine, line, MdLines);
                    continue;
                }
                if (MdLineHelper.IsHeaderLine(line))
                {
                    MdLineHelper.HandleHeaderLine(ref currentMdLine, line, MdLines);
                    continue;
                }
                if (MdLineHelper.IsEmptyLine(line))
                {
                    MdLineHelper.HandleEmptyLine(ref currentMdLine, line, MdLines);
                    continue;
                }
                if (currentMdLine is CodeLine || currentMdLine is OrderedListsLine)
                {
                    MdLines.Add(currentMdLine);
                    currentMdLine = new TextLine(line);
                    continue;
                }
                currentMdLine.AddContent(line);
            }
            if (currentMdLine.Content != null)
            {
                MdLines.Add(currentMdLine);
            }
            return(MdLines);
        }