diff --git a/_test/extra.txt b/_test/extra.txt index 748a4ef..3cebcb9 100644 --- a/_test/extra.txt +++ b/_test/extra.txt @@ -671,3 +671,16 @@ This line will be displayed. //= = = = = = = = = = = = = = = = = = = = = = = =// + + +52: windows-style newline and HTMLs + OPTIONS: {"enableEscape": true} +//- - - - - - - - -// +link + + +//- - - - - - - - -// +
+ +//= = = = = = = = = = = = = = = = = = = = = = = =// + diff --git a/parser/html_block.go b/parser/html_block.go index 531d2fb..e6f5a3f 100644 --- a/parser/html_block.go +++ b/parser/html_block.go @@ -76,7 +76,7 @@ var allowedBlockTags = map[string]bool{ "ul": true, } -var htmlBlockType1OpenRegexp = regexp.MustCompile(`(?i)^[ ]{0,3}<(script|pre|style|textarea)(?:\s.*|>.*|/>.*|)\n?$`) +var htmlBlockType1OpenRegexp = regexp.MustCompile(`(?i)^[ ]{0,3}<(script|pre|style|textarea)(?:\s.*|>.*|/>.*|)(?:\r\n|\n)?$`) var htmlBlockType1CloseRegexp = regexp.MustCompile(`(?i)^.*(?:script|pre|style|textarea)>.*`) var htmlBlockType2OpenRegexp = regexp.MustCompile(`^[ ]{0,3}'} var htmlBlockType3OpenRegexp = regexp.MustCompile(`^[ ]{0,3}<\?`) var htmlBlockType3Close = []byte{'?', '>'} -var htmlBlockType4OpenRegexp = regexp.MustCompile(`^[ ]{0,3}'} var htmlBlockType5OpenRegexp = regexp.MustCompile(`^[ ]{0,3}<\!\[CDATA\[`) var htmlBlockType5Close = []byte{']', ']', '>'} -var htmlBlockType6Regexp = regexp.MustCompile(`^[ ]{0,3}<(?:/[ ]*)?([a-zA-Z]+[a-zA-Z0-9\-]*)(?:[ ].*|>.*|/>.*|)\n?$`) +var htmlBlockType6Regexp = regexp.MustCompile(`^[ ]{0,3}<(?:/[ ]*)?([a-zA-Z]+[a-zA-Z0-9\-]*)(?:[ ].*|>.*|/>.*|)(?:\r\n|\n)?$`) -var htmlBlockType7Regexp = regexp.MustCompile(`^[ ]{0,3}<(/[ ]*)?([a-zA-Z]+[a-zA-Z0-9\-]*)(` + attributePattern + `*)[ ]*(?:>|/>)[ ]*\n?$`) +var htmlBlockType7Regexp = regexp.MustCompile(`^[ ]{0,3}<(/[ ]*)?([a-zA-Z]+[a-zA-Z0-9\-]*)(` + attributePattern + `*)[ ]*(?:>|/>)[ ]*(?:\r\n|\n)?$`) type htmlBlockParser struct { } diff --git a/parser/raw_html.go b/parser/raw_html.go index 43bbab7..1fb6c97 100644 --- a/parser/raw_html.go +++ b/parser/raw_html.go @@ -49,7 +49,7 @@ func (s *rawHTMLParser) Parse(parent ast.Node, block text.Reader, pc Context) as var tagnamePattern = `([A-Za-z][A-Za-z0-9-]*)` -var attributePattern = `(?:[\n \t]+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:[\n \t]*=[\n \t]*(?:[^\"'=<>` + "`" + `\x00-\x20]+|'[^']*'|"[^"]*"))?)` +var attributePattern = `(?:[\r\n \t]+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:[\r\n \t]*=[\r\n \t]*(?:[^\"'=<>` + "`" + `\x00-\x20]+|'[^']*'|"[^"]*"))?)` var openTagRegexp = regexp.MustCompile("^<" + tagnamePattern + attributePattern + `*[ \t]*/?>`) var closeTagRegexp = regexp.MustCompile("^" + tagnamePattern + `\s*>`) var commentRegexp = regexp.MustCompile(`^|`)