Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CentralNic
parsedown
Commits
47d8a138
Commit
47d8a138
authored
Dec 26, 2013
by
Emanuil Rusev
Browse files
implement automatic line breaks as an option
parent
fd42f2e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Parsedown.php
View file @
47d8a138
...
...
@@ -33,6 +33,19 @@ class Parsedown
private
static
$instances
=
array
();
#
# Setters
#
private
$break_marker
=
"
\n
"
;
function
set_breaks_enabled
(
$breaks_enabled
)
{
$this
->
break_marker
=
$breaks_enabled
?
"
\n
"
:
"
\n
"
;
return
$this
;
}
#
# Fields
#
...
...
@@ -658,7 +671,7 @@ class Parsedown
'_'
=>
'/^_(.*?)__(.+?)__(.*?)_/s'
,
);
private
function
parse_span_elements
(
$text
,
$markers
=
array
(
"
\n
"
,
'!['
,
'&'
,
'*'
,
'<'
,
'['
,
'_'
,
'`'
,
'http'
,
'~~'
))
private
function
parse_span_elements
(
$text
,
$markers
=
array
(
'!['
,
'&'
,
'*'
,
'<'
,
'['
,
'_'
,
'`'
,
'http'
,
'~~'
))
{
if
(
isset
(
$text
[
2
])
===
false
or
$markers
===
array
())
{
...
...
@@ -717,14 +730,6 @@ class Parsedown
switch
(
$closest_marker
)
{
case
"
\n
"
:
$markup
.
=
'<br />'
;
$offset
=
2
;
break
;
case
'!['
:
case
'['
:
...
...
@@ -979,6 +984,8 @@ class Parsedown
$markers
[
$closest_marker_index
]
=
$closest_marker
;
}
$markup
=
str_replace
(
$this
->
break_marker
,
'<br />'
.
"
\n
"
,
$markup
);
return
$markup
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment