Feat: Add preventing urlPreviewing by surrounding a link in angle brackets#552
Closed
nushea wants to merge 6 commits intoSableClient:devfrom
Closed
Feat: Add preventing urlPreviewing by surrounding a link in angle brackets#552nushea wants to merge 6 commits intoSableClient:devfrom
nushea wants to merge 6 commits intoSableClient:devfrom
Conversation
Member
|
Good stuff, my only feedback would be to lower the scope a bit and only allow So in case you want to use it in a link markdown, it can be used like this (as you already suggested):
Instead of this
|
9 tasks
nushea
pushed a commit
to Septicity/Sable
that referenced
this pull request
May 1, 2026
…ets (SableClient#717) <!-- Please read https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before submitting your pull request --> ### Description <!-- Please include a summary of the change. Please also include relevant motivation and context. List any dependencies that are required for this change. --> This PR implements preventing previews by surrounding a link in angle brackets, it hides the angle brackets in both the formatted_body and the regular body, and instead adds the links as skeletons to the bundled previews. This PR also serves as scaffolding for implementing the actual bundled previews. (example of the 4 usages) <img width="935" height="861" alt="image" src="https://github.com/user-attachments/assets/6abe5b6a-28ad-4a16-92a1-3c1483c565af" /> <img width="999" height="837" alt="image" src="https://github.com/user-attachments/assets/b4198734-4a3c-4320-ad2c-a1782b40d375" /> This PR matches the features SableClient#552 but uses the new standard way instead of an ad hoc solution #### Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) ### Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] My changes generate no new warnings ### AI disclosure: - [ ] Partially AI assisted (clarify which code was AI assisted and briefly explain what it does). - [ ] Fully AI generated (explain what all the generated code does in moderate detail). <!-- Write any explanation required here, but do not generate the explanation using AI!! You must prove you understand what the code in this PR does. --> My will be sin eater will clear me of the sin of having implemented this.
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.
Description
This is an implementation with the main purpose to serve as a proposal.
Currently there is no way to tell the client to not display a urlPreview if they are enabled, this PR proposes adding it by surrounding the link in angle brackets such as
<https://app.sable.moe>,[Sable!](<https://app.sable.moe>), or<[Sable!](https://app.sable.moe)>The message saves the angle brackets outside of the link tag regardless to not break the links on any other client that does not have the regular hide preview mode (so regardless of whether you type
[foo](<https://bar>)or<[foo](https://bar)>it will save it as<<a data-md href='https://bar'>foo</a>>as formatted text and<(foo)[https://bar]>as regular text)I am not sure if this would count as proper markdown but it is a very useful feature on discord and order platforms that have urlPreviews in order to prevent irrelevant previews intruding in the timeline.
Additionally, the implementation is working for me in all the cases i have tested but i am not a regex person by any means so if anyone could doublecheck my work it would be greatly appreciated.
Lastly, in this implementation the angle brackets get hidden regardless of whether it is rendering the formatted_body or the body, but i am not 100% sure if the regular body should get this type of formatting.
(normal look)

(new look)

Type of change
Checklist:
AI disclosure:
A demon whispered the implementation in my ears.