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

Converting 'line ending' to 'space' in Code span makes inconvenience #580

Closed
vanou opened this issue Apr 28, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@vanou
Copy link

commented Apr 28, 2019

Problem

From 0.29, code span normalizes content in following ways

  • First, line endings are converted to spaces.
  • If the resulting string both begins and ends with a space
    character, but does not consist entirely of space
    characters, a single space character is removed from the
    front and back. This allows you to include code that begins
    or ends with backtick characters, which must be separated by
    whitespace from the opening or closing backtick strings.

But, when you need to hard-wrap very long text (e.g. sha256 hash) in code span, this adds unnecessary space.

This CommonMark text

There is a chance to hard-wrap very long text (e.g. `sha256:e3b0c44298fc
1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`).

will become

There is a chance to hard-wrap very long text (e.g. sha256:e3b0c44298fc 1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855).

When you copy&paste this sha256 hash, you see a space between 44298fc and 1c149af.


Suggestion

Is following sufficient?

In code span normalization

  • First, line endings are removed.
  • If the resulting string both begins and ends with a space
    character, but does not consist entirely of space
    characters, a single space character is removed from the
    front and back. This allows you to include code that begins
    or ends with backtick characters, which must be separated by
    whitespace from the opening or closing backtick strings.
@jgm

This comment has been minimized.

Copy link
Member

commented Apr 28, 2019

The problem is that if you hard wrap your text, a space in a code block may turn into a line break. So it is most natural to interpret the line break as a space.

@jgm jgm closed this Apr 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.