chore: Fix links to rich reply fallback section

Since they were remove in Matrix 1.13, the section was removed and the information is now in an info box.
This commit is contained in:
Kévin Commaille 2024-12-20 10:49:59 +01:00 committed by strawberry
parent 3321286242
commit 9e9b59819c
5 changed files with 17 additions and 17 deletions

View File

@ -296,13 +296,13 @@ impl RoomMessageEventContent {
/// If this message contains HTML, this removes the [tags and attributes] that are not listed in /// If this message contains HTML, this removes the [tags and attributes] that are not listed in
/// the Matrix specification. /// the Matrix specification.
/// ///
/// It can also optionally remove the [rich reply fallback] from the plain text and HTML /// It can also optionally remove the [rich reply] fallback from the plain text and HTML
/// message. /// message.
/// ///
/// This method is only effective on text, notice and emote messages. /// This method is only effective on text, notice and emote messages.
/// ///
/// [tags and attributes]: https://spec.matrix.org/latest/client-server-api/#mroommessage-msgtypes /// [tags and attributes]: https://spec.matrix.org/latest/client-server-api/#mroommessage-msgtypes
/// [rich reply fallback]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies /// [rich reply]: https://spec.matrix.org/latest/client-server-api/#rich-replies
#[cfg(feature = "html")] #[cfg(feature = "html")]
pub fn sanitize( pub fn sanitize(
&mut self, &mut self,
@ -587,14 +587,14 @@ impl MessageType {
/// If this message contains HTML, this removes the [tags and attributes] that are not listed in /// If this message contains HTML, this removes the [tags and attributes] that are not listed in
/// the Matrix specification. /// the Matrix specification.
/// ///
/// It can also optionally remove the [rich reply fallback] from the plain text and HTML /// It can also optionally remove the [rich reply] fallback from the plain text and HTML
/// message. Note that you should be sure that the message is a reply, as there is no way to /// message. Note that you should be sure that the message is a reply, as there is no way to
/// differentiate plain text reply fallbacks and markdown quotes. /// differentiate plain text reply fallbacks and markdown quotes.
/// ///
/// This method is only effective on text, notice and emote messages. /// This method is only effective on text, notice and emote messages.
/// ///
/// [tags and attributes]: https://spec.matrix.org/latest/client-server-api/#mroommessage-msgtypes /// [tags and attributes]: https://spec.matrix.org/latest/client-server-api/#mroommessage-msgtypes
/// [rich reply fallback]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies /// [rich reply]: https://spec.matrix.org/latest/client-server-api/#rich-replies
#[cfg(feature = "html")] #[cfg(feature = "html")]
pub fn sanitize( pub fn sanitize(
&mut self, &mut self,
@ -773,12 +773,12 @@ impl FormattedBody {
/// ///
/// This removes any [tags and attributes] that are not listed in the Matrix specification. /// This removes any [tags and attributes] that are not listed in the Matrix specification.
/// ///
/// It can also optionally remove the [rich reply fallback]. /// It can also optionally remove the [rich reply] fallback.
/// ///
/// Returns the sanitized HTML if the format is `MessageFormat::Html`. /// Returns the sanitized HTML if the format is `MessageFormat::Html`.
/// ///
/// [tags and attributes]: https://spec.matrix.org/latest/client-server-api/#mroommessage-msgtypes /// [tags and attributes]: https://spec.matrix.org/latest/client-server-api/#mroommessage-msgtypes
/// [rich reply fallback]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies /// [rich reply]: https://spec.matrix.org/latest/client-server-api/#rich-replies
#[cfg(feature = "html")] #[cfg(feature = "html")]
pub fn sanitize_html( pub fn sanitize_html(
&mut self, &mut self,

View File

@ -1,8 +1,8 @@
//! Convenience methods and types to sanitize text messages. //! Convenience methods and types to sanitize text messages.
/// Remove the [rich reply fallback] of the given plain text string. /// Remove the [rich reply] fallback of the given plain text string.
/// ///
/// [rich reply fallback]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies /// [rich reply]: https://spec.matrix.org/latest/client-server-api/#rich-replies
pub fn remove_plain_reply_fallback(mut s: &str) -> &str { pub fn remove_plain_reply_fallback(mut s: &str) -> &str {
// A reply fallback must begin with a mention of the original sender between `<` and `>`, and // A reply fallback must begin with a mention of the original sender between `<` and `>`, and
// emotes add `*` as a prefix. If there is no newline, removing the detected fallback would // emotes add `*` as a prefix. If there is no newline, removing the detected fallback would

View File

@ -6,10 +6,10 @@ use crate::{Html, HtmlSanitizerMode, SanitizerConfig};
/// ///
/// This removes the [tags and attributes] that are not listed in the Matrix specification. /// This removes the [tags and attributes] that are not listed in the Matrix specification.
/// ///
/// It can also optionally remove the [rich reply fallback]. /// It can also optionally remove the [rich reply] fallback.
/// ///
/// [tags and attributes]: https://spec.matrix.org/latest/client-server-api/#mroommessage-msgtypes /// [tags and attributes]: https://spec.matrix.org/latest/client-server-api/#mroommessage-msgtypes
/// [rich reply fallback]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies /// [rich reply]: https://spec.matrix.org/latest/client-server-api/#rich-replies
pub fn sanitize_html( pub fn sanitize_html(
s: &str, s: &str,
mode: HtmlSanitizerMode, mode: HtmlSanitizerMode,
@ -27,9 +27,9 @@ pub fn sanitize_html(
sanitize_inner(s, &config) sanitize_inner(s, &config)
} }
/// Whether to remove the [rich reply fallback] while sanitizing. /// Whether to remove the [rich reply] fallback while sanitizing.
/// ///
/// [rich reply fallback]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies /// [rich reply]: https://spec.matrix.org/latest/client-server-api/#rich-replies
#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[allow(clippy::exhaustive_enums)] #[allow(clippy::exhaustive_enums)]
pub enum RemoveReplyFallback { pub enum RemoveReplyFallback {
@ -40,12 +40,12 @@ pub enum RemoveReplyFallback {
No, No,
} }
/// Remove the [rich reply fallback] of the given HTML string. /// Remove the [rich reply] fallback of the given HTML string.
/// ///
/// Due to the fact that the HTML is parsed, note that malformed HTML and comments will be stripped /// Due to the fact that the HTML is parsed, note that malformed HTML and comments will be stripped
/// from the output. /// from the output.
/// ///
/// [rich reply fallback]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies /// [rich reply]: https://spec.matrix.org/latest/client-server-api/#rich-replies
pub fn remove_html_reply_fallback(s: &str) -> String { pub fn remove_html_reply_fallback(s: &str) -> String {
let config = SanitizerConfig::new().remove_reply_fallback(); let config = SanitizerConfig::new().remove_reply_fallback();
sanitize_inner(s, &config) sanitize_inner(s, &config)

View File

@ -216,7 +216,7 @@ pub enum MatrixElement {
/// [`mx-reply`], a Matrix rich reply fallback element. /// [`mx-reply`], a Matrix rich reply fallback element.
/// ///
/// [`mx-reply`]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies /// [`mx-reply`]: https://spec.matrix.org/latest/client-server-api/#rich-replies
MatrixReply, MatrixReply,
/// An HTML element that is not in the suggested list. /// An HTML element that is not in the suggested list.

View File

@ -176,7 +176,7 @@ impl SanitizerConfig {
self self
} }
/// Remove the [rich reply fallback]. /// Remove the [rich reply] fallback.
/// ///
/// Calling this allows to remove the `mx-reply` element in addition to the list of elements to /// Calling this allows to remove the `mx-reply` element in addition to the list of elements to
/// remove. /// remove.
@ -184,7 +184,7 @@ impl SanitizerConfig {
/// Removing elements has a higher priority than ignoring or allowing. So if this settings is /// Removing elements has a higher priority than ignoring or allowing. So if this settings is
/// set, `mx-reply` will always be removed. /// set, `mx-reply` will always be removed.
/// ///
/// [rich reply fallback]: https://spec.matrix.org/latest/client-server-api/#fallbacks-for-rich-replies /// [rich reply]: https://spec.matrix.org/latest/client-server-api/#rich-replies
pub fn remove_reply_fallback(mut self) -> Self { pub fn remove_reply_fallback(mut self) -> Self {
self.remove_reply_fallback = true; self.remove_reply_fallback = true;
self self