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

Empty destinations in link references #172

Closed
mildsunrise opened this issue Oct 27, 2014 · 8 comments
Closed

Empty destinations in link references #172

mildsunrise opened this issue Oct 27, 2014 · 8 comments
Labels
Milestone

Comments

@mildsunrise
Copy link
Contributor

Since <> is a valid link destination, a link reference should be able to have <> as the destination.

So I suggest to add the following test in link references:

.
[foo]: <>

[foo]
.
<p><a href="">foo</a></p>
.

May result obvious but some parsers (including the JS implementation) fail.

@jgm
Copy link
Member

jgm commented Oct 29, 2014

Removing the test for an empty URL in js/lib/inlines.js, line 362, fixes the js implementation for this test, but causes it to fail the test:

.
[foo]:

[foo]
.
<p>[foo]:</p>
<p>[foo]</p>
.

I wonder, though: shouldn't we allow this kind of thing too as a way of specifying an empty link?

@mildsunrise
Copy link
Contributor Author

Yeah, we could allow it for more consistency with inline links.

@rlidwka
Copy link
Contributor

rlidwka commented Oct 29, 2014

[foo]: <> looks like an empty link indeed, but [foo]: should not be parsed as a reference imho.

@Knagis
Copy link
Contributor

Knagis commented Oct 29, 2014

In my opinion the question that should be answered is "Are empty links allowed in the references and inline links?".

If the answer is yes, then both [foo]:<> and [foo]: should be recognized as valid and empty links to reduce further surprises.

I don't see how [foo]: could be present in a document on its own line but the writer intended it to mean anything else... Although... Maybe something like this where this sort-of reference is followed by a list:

[horse]: http://wiki/horse
[animals]:
1. [horse];
2. [cat];

[animals]: http://wiki/animals

Babelmark2

@jgm
Copy link
Member

jgm commented Nov 11, 2014

I once had the thought that an empty reference definition could be given a special meaning as an anchor, as illustrated by the following (which would have been really handy in spec.txt):

[link text]:

The link text cannot contain links, though it may
contain images.  Etc.

... later ...

See the discussion of [link text], above.

where this gets converted to:

<a id="link-text"></a>

<p>The link text cannot contain links, though it may
contain images.  Etc.</p>

... later ...

<p>See the discussion of <a href="#link-text">link text</a>, above.</p>

I think it was that thought that made me hesitate about interpreting empty link definitions as defining regular links to empty URLs.

@mildsunrise
Copy link
Contributor Author

I love the idea!

@rlidwka
Copy link
Contributor

rlidwka commented Nov 11, 2014

Yep, same here. Links to the same document frequently appear in readme's for example, it'd be nice to avoid putting html tags there.

@jgm jgm added the spec label Nov 17, 2014
@jgm
Copy link
Member

jgm commented Dec 29, 2014

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

No branches or pull requests

4 participants