Exemple #1
0
        internal CodeBlockInfo(FencedCodeBlock codeBlock, StringSlice slice)
        {
            Info           = codeBlock.Info ?? string.Empty;
            Arguments      = codeBlock.Arguments ?? string.Empty;
            Lines          = codeBlock.Lines;
            CodeBlockSlice = slice;
            Source         = CodeBlockSlice.Text;

            int contentStart = Lines.Lines[0].Position;
            var lastLine     = Lines.Last();
            int contentEnd   = lastLine.Position + lastLine.Slice.Length - 1;

            ContentSpan  = new SourceSpan(contentStart, contentEnd);
            ContentSlice = CodeBlockSlice.Reposition(ContentSpan);
            Content      = ContentSlice.ToString();
        }