Header menu logo FSharp.Formatting

SourceFormat Type

Provides a base implementation for all code formatters.

To display the formatted code on your web site, the web page must refer to a stylesheet that defines the formatting for the different CSS classes generated by CSharpFormat: .csharpcode, pre, .rem, .kwrd, .str, .op, .preproc, .alt, .lnum.

Note that if you have multi-line comments in your source code (like /* ... */), the "line numbers" or "alternate line background" options will generate code that is not strictly HTML 4.01 compliant. The code will still look good with IE5+ or Mozilla 0.8+.

Constructors

Constructor Description

SourceFormat()

Full Usage: SourceFormat()


            

Instance members

Instance member Description

this.Alternate

Full Usage: this.Alternate

Enables or disables alternating line background.

this.CodeRegex

Full Usage: this.CodeRegex

The regular expression used to capture language tokens.

this.EmbedStyleSheet

Full Usage: this.EmbedStyleSheet

Enables or disables the embedded CSS style sheet.

this.FormatCode

Full Usage: this.FormatCode

Parameters:
    source : Stream - Source code stream.

Returns: string A string containing the HTML formatted code.

Transforms a source code stream to HTML 4.01.

source : Stream

Source code stream.

Returns: string

A string containing the HTML formatted code.

this.FormatCode

Full Usage: this.FormatCode

Parameters:
    source : string

Returns: string A string containing the HTML formatted code.

Transforms a source code string to HTML 4.01.

source : string
Returns: string

A string containing the HTML formatted code.

this.FormatSubCode

Full Usage: this.FormatSubCode

Parameters:
    source : string

Returns: string

Allows formatting a part of the code in a different language, for example a JavaScript block inside an HTML file.

source : string
Returns: string

this.LineNumbers

Full Usage: this.LineNumbers

Enables or disables line numbers in output.

this.TabSpaces

Full Usage: this.TabSpaces

Gets or sets the tabs width.

Static members

Static member Description

SourceFormat.EscapeHtml(str, tabSpaces)

Full Usage: SourceFormat.EscapeHtml(str, tabSpaces)

Parameters:
    str : string
    tabSpaces : int

Returns: string

TBD

str : string
tabSpaces : int
Returns: string

SourceFormat.GetCssStream()

Full Usage: SourceFormat.GetCssStream()

Returns: Stream A text Stream of the CSS definitions.

Gets the CSS stylesheet as a stream.

Returns: Stream

A text Stream of the CSS definitions.

SourceFormat.GetCssString()

Full Usage: SourceFormat.GetCssString()

Returns: string A string containing the CSS definitions.

Gets the CSS stylesheet as a string.

Returns: string

A string containing the CSS definitions.

Type something to start searching.