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

Preformatted inline code #319

Merged
merged 1 commit into from
Dec 8, 2020

Conversation

martincizek
Copy link
Collaborator

@martincizek martincizek commented Apr 1, 2020

Add support for interpreting <code> as a preformatted inline element and rendering Markdown accordingly. Fix #318.

This PR builds on previous PRs #315 and #317.

Quality assurance:

  • Changes in collapse-whitespace.js also submitted to the original collapse-whitespace project. The code is the very same except for coding style nuances.
  • All previous tests in the collapse-whitespace project pass. New tests added for the new behavior, checking it matches browser behavior.
  • The rest of Turndown is unaffected without preformattedCode enabled.
  • There is not much complexity added, actually preformatted code behaves almost like block elements.
  • We believe it is a core thing related to basic HTML semantics, just like <pre> for block preformatted code. So merging this to Turndown's core is justifiable.

Performance:

  • Couple of lines added.
  • No new costly operations.

michbart pushed a commit to orchitech/turndown that referenced this pull request Apr 8, 2020
michbart pushed a commit to orchitech/turndown that referenced this pull request Apr 16, 2020
@martincizek martincizek force-pushed the preformatted-code branch 2 times, most recently from 85a6fd7 to d541223 Compare July 6, 2020 18:46
@martincizek
Copy link
Collaborator Author

Rebased to the new master and removed a JS test case which is actually covered in HTML tests.

Copy link
Collaborator

@pavelhoral pavelhoral left a comment

Choose a reason for hiding this comment

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

LGTM

@martincizek
Copy link
Collaborator Author

LGTM

Thanks for your "interrogation" in chat. :-)

I also checked that nothing has changed in the standard code rule. And it's OK, the code rule still clearly mirrors the CommonMark spec, so it will work correctly both with collapsed and preformatted content.

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.

Preformatted inline code
2 participants