CodeBlock Class

Definition

Caution

Parsing code has been deprecated, we suggest using Markdig. See https://github.com/windows-toolkit/WindowsCommunityToolkit/issues/3200 for more info.

Caution

Parsing code has been deprecated, we suggest using Markdig. See https://github.com/CommunityToolkit/WindowsCommunityToolkit/issues/3200 for more info.

Represents a block of text that is displayed in a fixed-width font. Inline elements and escape sequences are ignored inside the code block.

public class CodeBlock : Microsoft.Toolkit.Parsers.Markdown.Blocks.MarkdownBlock
[System.Obsolete("Parsing code has been deprecated, we suggest using Markdig. See https://github.com/windows-toolkit/WindowsCommunityToolkit/issues/3200 for more info.")]
public class CodeBlock : Microsoft.Toolkit.Parsers.Markdown.Blocks.MarkdownBlock
[System.Obsolete("Parsing code has been deprecated, we suggest using Markdig. See https://github.com/CommunityToolkit/WindowsCommunityToolkit/issues/3200 for more info.")]
public class CodeBlock : Microsoft.Toolkit.Parsers.Markdown.Blocks.MarkdownBlock
type CodeBlock = class
    inherit MarkdownBlock
[<System.Obsolete("Parsing code has been deprecated, we suggest using Markdig. See https://github.com/windows-toolkit/WindowsCommunityToolkit/issues/3200 for more info.")>]
type CodeBlock = class
    inherit MarkdownBlock
[<System.Obsolete("Parsing code has been deprecated, we suggest using Markdig. See https://github.com/CommunityToolkit/WindowsCommunityToolkit/issues/3200 for more info.")>]
type CodeBlock = class
    inherit MarkdownBlock
Public Class CodeBlock
Inherits MarkdownBlock
Inheritance
Attributes

Constructors

CodeBlock()

Initializes a new instance of the CodeBlock class.

Properties

CodeLanguage

Gets or sets the Language specified in prefix, e.g. ```c# (GitHub Style Parsing).

This does not guarantee that the Code Block has a language, or no language, some valid code might not have been prefixed, and this will still return null.

To ensure all Code is Highlighted (If desired), you might have to determine the language from the provided string, such as looking for key words.
Text

Gets or sets the source code to display.

Type

Gets or sets tells us what type this element is.

(Inherited from MarkdownBlock)

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from MarkdownBlock)
GetHashCode()

Serves as the default hash function.

(Inherited from MarkdownBlock)
ToString()

Converts the object into it's textual representation.

Applies to