Repository navigation
Conversation
The excerpt used for the description meta tags is taken from the raw comment text, so link URLs could end up in it. For example, a Markdown comment "Foo." followed by "[Example Link](https://example.com)" got the excerpt "Foo. example.", the second sentence being the "example." part of the URL. Before taking the excerpt, replace links with their text (Markdown [text](url) for Markdown comments, {text}[url] and text[url] for RDoc markup), drop Markdown images, and remove bare URLs. Fixes ruby#1857
Documentation previewCommit: |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1857. The excerpt used for the
description,og:descriptionandtwitter:descriptionmeta tags is matched against the raw comment text, so link URLs can leak into it. For the example in the issue, a Markdown commentFoo.followed by[Example Link](https://example.com)got the excerptFoo. example., whereexample.is the domain part of the URL.Darkfish#excerpt(also used by Aliki) now cleans up links before matching. Links become their text ([text](url)for Markdown comments,{text}[url]andtext[url]for RDoc markup), Markdown images such as badges are dropped, and barehttp(s)/ftpURLs are removed. The issue's example now givesFoo..On RDoc's own documentation, only three pages get a different description.
CONTRIBUTING.mdanddoc/configuration.mdno longer end in URL or link-syntax fragments (a trailinggithub.and a stray[). ForRDoc::TomDocthe second sentence becomesThe TomDoc specification can be found at ., which is still not great but no longer mixes in text from an unrelated paragraph. Bare URLs keep their trailing punctuation, so a sentence ending in a URL still ends the sentence. All other pages are unchanged.