コード例 #1
0
ファイル: MdWriter.cs プロジェクト: adrianstevens/MarkdownOut
        /// <summary>
        /// Writes the provided output to the file using the
        /// <see cref="MdFormat.UnorderedListItem"/> format, followed by a Markdown paragraph break
        /// to terminate the list item.
        /// </summary>
        /// <param name="output">The output to write.</param>
        /// <param name="listIndent">
        /// The optional indent of the list item (0 adds no indent, 1 adds a single indentation to
        /// create a sublist, etc). Negative values are ignored.
        /// </param>
        /// <param name="style">The optional Markdown style to apply.</param>
        public void WriteUnorderedListItem(object output, int listIndent = 0,
                                           MdStyle style = MdStyle.None)
        {
            string text = MdText.StyleAndFormat(output, style, MdFormat.UnorderedListItem);

            text = MdText.Indent(text, listIndent);
            stream.Write(MdText.Cleanse(text, true) + MdText.ParagraphBreak);
        }
コード例 #2
0
        /// <summary>
        /// Writes the provided output to the file using the
        /// <see cref="MdFormat.UnorderedListItem"/> format, followed by a Markdown paragraph break
        /// to terminate the list item.
        /// </summary>
        /// <param name="output">The output to write.</param>
        /// <param name="listIndent">
        /// The optional indent of the list item (0 adds no indent, 1 adds a single indentation to
        /// create a sublist, etc). Negative values are ignored.
        /// </param>
        /// <param name="style">The optional Markdown style to apply.</param>

        /// <param name="format">The optional Markdown format to apply.</param>
        /// </param>
        public void WriteUnorderedListItem(object output, int listIndent = 0,
                                           MdStyle style = MdStyle.None, MdFormat format = MdFormat.None, int numNewLines = 1)
        {
            string text = MdText.Format(output, format);

            text = MdText.StyleAndFormat(text, style, MdFormat.UnorderedListItem);
            text = MdText.Indent(text, listIndent);
            _Stream.Write(MdText.Cleanse(text, true)
                          + MakeParagraphLineBreak(numNewLines));
        }
コード例 #3
0
        /// <summary>
        /// Writes the provided output to the file using the <see cref="MdFormat.OrderedListItem"/>
        /// format, followed by a Markdown paragraph break to terminate the list item.
        /// </summary>
        /// <param name="output">The output to write.</param>
        /// <param name="itemNumber">
        /// The optional item number of the list item. Does not affect parsed Markdown output or the
        /// list order, only the raw text. Negative values are ignored.
        /// </param>
        /// <param name="listIndent">
        /// The optional indent of the list item (0 adds no indent, 1 adds a single indentation to
        /// create a sublist, etc). Negative values are ignored.
        /// </param>
        /// <param name="style">The optional Markdown style to apply.</param>
        public void WriteOrderedListItem(object output, int itemNumber = 1, int listIndent = 0,
                                         MdStyle style = MdStyle.None)
        {
            string text = MdText.StyleAndFormat(output, style, MdFormat.OrderedListItem);

            //replace the list item number supplied by MdText with the number provided
            if (itemNumber != MdText.DefaultListItemNumber && itemNumber >= 0)
            {
                text = itemNumber + text.Substring(1);
            }
            text = MdText.Indent(text, listIndent);
            _Stream.Write(MdText.Cleanse(text, true) + MdText.ParagraphBreak);
        }