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

allow space in SUMMARY.md's link destination #1293

Merged
merged 2 commits into from Aug 8, 2020

Conversation

Evian-Zhang
Copy link
Contributor

Related issues: #527 #1287

As stated in CommonMark Spec:

A link destination consists of either

  • a sequence of zero or more characters between an opening < and a closing > that contains no spaces, line breaks, or unescaped < or > characters, or

  • a nonempty sequence of characters that does not include ASCII space or control characters, and includes parentheses only if (a) they are backslash-escaped or (b) they are part of a balanced pair of unescaped parentheses. (Implementations may impose limits on parentheses nesting to avoid performance issues, but at least three levels of nesting should be supported.)

and according to this and MDN spec Percent-encoding, there are three ways to allow space in link destination:

- [test1](./test%20link1.md)
- [test2](./test+link2.md)
- [test3](<./test link3.md>)

For now, mdBook only supports method 3, which is rarely used compared to method 1 and 2.

So I fix it and add a test.

@ehuss
Copy link
Contributor

ehuss commented Aug 7, 2020

Thanks for the PR! I would prefer to stick with the behavior from markdown where %20 is converted to space. The + transformation isn't something that is normally done for path components in URLs (or in markdown). Would you mind removing the + transformation?

Also, it looks like rustfmt needs to be run.

@Evian-Zhang
Copy link
Contributor Author

Thanks for the PR! I would prefer to stick with the behavior from markdown where %20 is converted to space. The + transformation isn't something that is normally done for path components in URLs (or in markdown). Would you mind removing the + transformation?

Also, it looks like rustfmt needs to be run.

Ok. I have removed the + transformation and ran rustfmt.

Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

Thanks!

@ehuss ehuss merged commit 3d44553 into rust-lang:master Aug 8, 2020
Ruin0x11 pushed a commit to Ruin0x11/mdBook that referenced this pull request Aug 30, 2020
allow space in SUMMARY.md's link destination
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.

None yet

2 participants