Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GFM: Line break using a backslash #169

Open
ArthaTi opened this issue Apr 9, 2019 · 1 comment
Open

GFM: Line break using a backslash #169

ArthaTi opened this issue Apr 9, 2019 · 1 comment

Comments

@ArthaTi
Copy link

ArthaTi commented Apr 9, 2019

The GFM spec specifies that to make a line break, a backslash can be used so it is more visible. It also better because some editors automatically remove trailing whitespace.

The GithubMarkdown class doesn't support those. Only double-space breaks are allowed. It would be really nice if that feature would be added.

I tried doing this myself, but renderText receives line text and the backslash as separate blocks, so I kinda failed there. Also, what would be the preferred way to do this? Is changing the escape code parser necessary?

@cebe
Copy link
Owner

cebe commented Apr 10, 2019

The GithubMarkdown class doesn't support those. Only double-space breaks are allowed. It would be really nice if that feature would be added.

seems it is a newly added feature.

  • \ is a marker for the parseEscape function, so extending it should allow implementing this:

markdown/Parser.php

Lines 368 to 378 in eeb1bf6

/**
* Parses escaped special characters.
* @marker \
*/
protected function parseEscape($text)
{
if (isset($text[1]) && in_array($text[1], $this->escapeCharacters)) {
return [['text', $text[1]], 2];
}
return [['text', $text[0]], 1];
}

have not checked it in detail though.

ArthaTi pushed a commit to ArthaTi/markdown that referenced this issue Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants