GetDelimiterRegex(string, bool, string, bool, bool) Method
Gets a regex pattern for front matter using the specified delimiters.
Namespace
Statiq.Core
Containing Type
ExtractFrontMatter

Syntax

public static string GetDelimiterRegex(string startDelimiter, bool startRepeated, string endDelimiter, bool endRepeated, bool ignoreEndDelimiterOnFirstLine = true)

Remarks

With Jekyll style delimiters ("-" for the end delimiter allowing repeating and no start delimiter), this returns \A(?:^\r*-+[^\S\n]*$\r?\n)?(.*?)(?:^\r*-+[^\S\n]*$\r?\n).

Parameters

Name Type Description
startDelimiter string The front matter start delimiter, or null to use the end delimiter as the start delimiter.
startRepeated bool true to allow the start delimiter to repeat, false to require it verbatim.
endDelimiter string The front matter end delimiter. If this is null then a null value is returned.
endRepeated bool true to allow the end delimiter to repeat, false to require it verbatim.
ignoreEndDelimiterOnFirstLine bool Ignores the delimiter if it appears on the first line. This is useful when processing Jekyll style front matter that has the delimiter both above and below the front matter content. This has no effect if a start delimiter is specified.

Return Value

Type Description
string A regular expression that finds front matter using the specified delimiters.