TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Right way to include an URL in a plain text sentence?

4 pointsby lajarreabout 9 years ago
I like to be careful about correct spacing and syntax while writing plain text. In an English sentence, there is no space before the final dot. But if my sentence is: "Hey checkout this website http://example.com" I can't add the dot since it will change the URL. What is the correct way to write this? Is there any standard on the subject?

3 comments

socca1157about 9 years ago
&quot;Tradition in such plain text messages is to surround the URL with &lt; and &gt; as kind of quotation marks (as the latter can be problematic too; depends on the algorithm of the URL detector): You can see that in &lt;<a href="http:&#x2F;&#x2F;example.com&#x2F;foo&gt;.&quot;" rel="nofollow">http:&#x2F;&#x2F;example.com&#x2F;foo&gt;.&quot;</a>
评论 #11685141 未加载
JayNeelyabout 9 years ago
<a href="http:&#x2F;&#x2F;ux.stackexchange.com&#x2F;questions&#x2F;15226&#x2F;should-a-sentence-ending-with-a-url-terminate-with-a-period" rel="nofollow">http:&#x2F;&#x2F;ux.stackexchange.com&#x2F;questions&#x2F;15226&#x2F;should-a-sentenc...</a>
DanBCabout 9 years ago
I prefer &lt;angle brackets&gt;, but these brake in some places.<p>RFCs have some useful info.<p><a href="https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc3986" rel="nofollow">https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc3986</a> Appendix C<p>Appendix C. Delimiting a URI in Context<p><pre><code> URIs are often transmitted through formats that do not provide a clear context for their interpretation. For example, there are many occasions when a URI is included in plain text; examples include text sent in email, USENET news, and on printed paper. In such cases, it is important to be able to delimit the URI from the rest of the text, and in particular from punctuation marks that might be mistaken for part of the URI. In practice, URIs are delimited in a variety of ways, but usually within double-quotes &quot;http:&#x2F;&#x2F;example.com&#x2F;&quot;, angle brackets &lt;http:&#x2F;&#x2F;example.com&#x2F;&gt;, or just by using whitespace: http:&#x2F;&#x2F;example.com&#x2F; These wrappers do not form part of the URI. In some cases, extra whitespace (spaces, line-breaks, tabs, etc.) may have to be added to break a long URI across lines. The whitespace should be ignored when the URI is extracted. No whitespace should be introduced after a hyphen (&quot;-&quot;) character. Because some typesetters and printers may (erroneously) introduce a hyphen at the end of line when breaking it, the interpreter of a URI containing a line break immediately after a hyphen should ignore all whitespace around the line break and should be aware that the hyphen may or may not actually be part of the URI. Using &lt;&gt; angle brackets around each URI is especially recommended as a delimiting style for a reference that contains embedded whitespace. The prefix &quot;URL:&quot; (with or without a trailing space) was formerly recommended as a way to help distinguish a URI from other bracketed designators, though it is not commonly used in practice and is no longer recommended. For robustness, software that accepts user-typed URI should attempt to recognize and strip both delimiters and embedded whitespace. For example, the text Yes, Jim, I found it under &quot;http:&#x2F;&#x2F;www.w3.org&#x2F;Addressing&#x2F;&quot;, but you can probably pick it up from &lt;ftp:&#x2F;&#x2F;foo.example. com&#x2F;rfc&#x2F;&gt;. Note the warning in &lt;http:&#x2F;&#x2F;www.ics.uci.edu&#x2F;pub&#x2F; ietf&#x2F;uri&#x2F;historical.html#WARNING&gt;. contains the URI references http:&#x2F;&#x2F;www.w3.org&#x2F;Addressing&#x2F; ftp:&#x2F;&#x2F;foo.example.com&#x2F;rfc&#x2F; http:&#x2F;&#x2F;www.ics.uci.edu&#x2F;pub&#x2F;ietf&#x2F;uri&#x2F;historical.html#WARNING</code></pre>