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

Lets \n to be present in <pre> tag. solves #77 #78

Merged
merged 1 commit into from
Oct 31, 2021

Conversation

shivabhusal
Copy link
Contributor

@shivabhusal shivabhusal commented Oct 2, 2019

It solves the issue I reported: #77

@@ -17,6 +17,9 @@ def treat(node, state)
case node.name
when 'code'
node.text
when 'text'
# Preserve '\n' in the middle of text/words, get rid of indentation spaces
ReverseMarkdown.cleaner.remove_leading_newlines(node.text.gsub("\n", '<br>').strip.gsub('<br>', "\n"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICS this can be simplified to

Suggested change
ReverseMarkdown.cleaner.remove_leading_newlines(node.text.gsub("\n", '<br>').strip.gsub('<br>', "\n"))
node.text

At least it will pass all provided test cases, right?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shivabhusal, can you look into this PR when you get a chance?

Seems to me like @xijo's proposal works just fine:

when 'code', 'text'
  node.text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants