src/Blocks/Heading.cs
/// <summary>
/// Writes the block to the given TextWriter.
/// </summary>
/// <param name="writer">writer</param>
/// <param name="formatting">optional formatting</param>
Writes the block to the given TextWriter.
Writes the block to the given TextWriter .
public override void Write(TextWriter writer, MarkdownFormatting formatting)
        {
            var sw = new StringWriter();
            base.Write(sw, formatting);
            string title = sw.ToString()
                .Replace("\r", "")
                .Replace("\n", " ")
                .TrimEnd();
            if (formatting?.UseAlternateHeaderSyntax == true && Level <= 2)
            {
                writer.WriteLine(title);
                writer.Write(new string( Level == 1 ? '=' : '-', title.Length));
            }
            else
            {
                writer.Write(new string('#', Level) + " " + title);
                if (!string.IsNullOrEmpty(Id))
                    writer.Write(" {#" + Id.Trim() + "}");
            }
            writer.WriteLine();
            writer.WriteLine();
        }
public override void Write ( TextWriter writer , MarkdownFormatting formatting ) { var sw = new StringWriter ( ) ; base . Write ( sw , formatting ) ; string title = sw . ToString ( ) . Replace ( " \r " , " " ) . Replace ( " \n " , " " ) . TrimEnd ( ) ; if ( formatting ? . UseAlternateHeaderSyntax == true && Level <= 2 ) { writer . WriteLine ( title ) ; writer . Write ( new string ( Level == 1 ? ' ' : ' ' , title . Length ) ) ; } else { writer . Write ( new string ( ' ' , Level ) + " " + title ) ; if ( ! string . IsNullOrEmpty ( Id ) ) writer . Write ( " " + Id . Trim ( ) + " " ) ; } writer . WriteLine ( ) ; writer . WriteLine ( ) ; }
Writes the block to the given TextWriter.
Writes the block to the given TextWriter .
writer
TextWriter
None
formatting
MarkdownFormatting
None