mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 09:05:56 +00:00
Added support for variable line endings (fixes parsing of documents with Windows line endings).
This commit is contained in:
parent
fd9a7da68b
commit
1ab48be9ee
@ -69,7 +69,7 @@ class DocumentationParser
|
||||
$end = false;
|
||||
$debug = false;
|
||||
|
||||
$lines = explode("\n", $md);
|
||||
$lines = preg_split('/\\r\\n|\\r|\\n/', $md);
|
||||
$output = array();
|
||||
|
||||
foreach ($lines as $i => $line) {
|
||||
@ -394,7 +394,7 @@ class DocumentationParser
|
||||
$headingText .= "-" . self::$heading_counts[$headingText];
|
||||
}
|
||||
|
||||
return sprintf("%s {#%s}", preg_replace('/\n/', '', $heading), self::generate_html_id($headingText));
|
||||
return sprintf("%s {#%s}", preg_replace('/\\r\\n|\\r|\\n/', '', $heading), self::generate_html_id($headingText));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user