From 31769364281cc845ee4a76f83bdfb2a6f9a38f03 Mon Sep 17 00:00:00 2001 From: Lexi Robinson Date: Fri, 29 May 2026 08:14:42 +0100 Subject: [PATCH] Add the `style` attribute to remaining RichTextElementParts According to the docs[1] and Node SDK[2] all rich text element parts support the `style` attribute, so I've added it where missing. [1]: https://docs.slack.dev/reference/block-kit/blocks/rich-text-block#date-element-type [2]: https://github.com/slackapi/node-slack-sdk/blob/b12a62f15e54b076183844493fe3677dd3a702b5/packages/types/src/block-kit/block-elements.ts#L833 --- docs/reference/models/blocks/block_elements.html | 14 ++++++++++---- docs/reference/models/blocks/index.html | 14 ++++++++++---- slack_sdk/models/blocks/block_elements.py | 12 +++++++++--- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/docs/reference/models/blocks/block_elements.html b/docs/reference/models/blocks/block_elements.html index 880573706..eb2ff1d2a 100644 --- a/docs/reference/models/blocks/block_elements.html +++ b/docs/reference/models/blocks/block_elements.html @@ -3392,7 +3392,7 @@

Inherited members

@property def attributes(self) -> Set[str]: # type: ignore[override] - return super().attributes.union({"timestamp", "format", "url", "fallback"}) + return super().attributes.union({"timestamp", "format", "url", "fallback", "style"}) def __init__( self, @@ -3401,6 +3401,7 @@

Inherited members

format: str, url: Optional[str] = None, fallback: Optional[str] = None, + style: Optional[Union[dict, "RichTextElementParts.TextStyle"]] = None, **others: dict, ): super().__init__(type=self.type) @@ -3409,40 +3410,45 @@

Inherited members

self.format = format self.url = url self.fallback = fallback + self.style = style class Broadcast(RichTextElement): type = "broadcast" @property def attributes(self) -> Set[str]: # type: ignore[override] - return super().attributes.union({"range"}) + return super().attributes.union({"range", "style"}) def __init__( self, *, range: str, # channel, here, .. + style: Optional[Union[dict, "RichTextElementParts.TextStyle"]] = None, **others: dict, ): super().__init__(type=self.type) show_unknown_key_warning(self, others) self.range = range + self.style = style class Color(RichTextElement): type = "color" @property def attributes(self) -> Set[str]: # type: ignore[override] - return super().attributes.union({"value"}) + return super().attributes.union({"value", "style"}) def __init__( self, *, value: str, + style: Optional[Union[dict, "RichTextElementParts.TextStyle"]] = None, **others: dict, ): super().__init__(type=self.type) show_unknown_key_warning(self, others) - self.value = value + self.value = value + self.style = style

Class variables

diff --git a/docs/reference/models/blocks/index.html b/docs/reference/models/blocks/index.html index 90d5e0d41..88161b62c 100644 --- a/docs/reference/models/blocks/index.html +++ b/docs/reference/models/blocks/index.html @@ -6410,7 +6410,7 @@

Inherited members

@property def attributes(self) -> Set[str]: # type: ignore[override] - return super().attributes.union({"timestamp", "format", "url", "fallback"}) + return super().attributes.union({"timestamp", "format", "url", "fallback", "style"}) def __init__( self, @@ -6419,6 +6419,7 @@

Inherited members

format: str, url: Optional[str] = None, fallback: Optional[str] = None, + style: Optional[Union[dict, "RichTextElementParts.TextStyle"]] = None, **others: dict, ): super().__init__(type=self.type) @@ -6427,40 +6428,45 @@

Inherited members

self.format = format self.url = url self.fallback = fallback + self.style = style class Broadcast(RichTextElement): type = "broadcast" @property def attributes(self) -> Set[str]: # type: ignore[override] - return super().attributes.union({"range"}) + return super().attributes.union({"range", "style"}) def __init__( self, *, range: str, # channel, here, .. + style: Optional[Union[dict, "RichTextElementParts.TextStyle"]] = None, **others: dict, ): super().__init__(type=self.type) show_unknown_key_warning(self, others) self.range = range + self.style = style class Color(RichTextElement): type = "color" @property def attributes(self) -> Set[str]: # type: ignore[override] - return super().attributes.union({"value"}) + return super().attributes.union({"value", "style"}) def __init__( self, *, value: str, + style: Optional[Union[dict, "RichTextElementParts.TextStyle"]] = None, **others: dict, ): super().__init__(type=self.type) show_unknown_key_warning(self, others) - self.value = value + self.value = value + self.style = style

Class variables

diff --git a/slack_sdk/models/blocks/block_elements.py b/slack_sdk/models/blocks/block_elements.py index bcf7adfe0..813f2ec5e 100644 --- a/slack_sdk/models/blocks/block_elements.py +++ b/slack_sdk/models/blocks/block_elements.py @@ -2234,7 +2234,7 @@ class Date(RichTextElement): @property def attributes(self) -> Set[str]: # type: ignore[override] - return super().attributes.union({"timestamp", "format", "url", "fallback"}) + return super().attributes.union({"timestamp", "format", "url", "fallback", "style"}) def __init__( self, @@ -2243,6 +2243,7 @@ def __init__( format: str, url: Optional[str] = None, fallback: Optional[str] = None, + style: Optional[Union[dict, "RichTextElementParts.TextStyle"]] = None, **others: dict, ): super().__init__(type=self.type) @@ -2251,37 +2252,42 @@ def __init__( self.format = format self.url = url self.fallback = fallback + self.style = style class Broadcast(RichTextElement): type = "broadcast" @property def attributes(self) -> Set[str]: # type: ignore[override] - return super().attributes.union({"range"}) + return super().attributes.union({"range", "style"}) def __init__( self, *, range: str, # channel, here, .. + style: Optional[Union[dict, "RichTextElementParts.TextStyle"]] = None, **others: dict, ): super().__init__(type=self.type) show_unknown_key_warning(self, others) self.range = range + self.style = style class Color(RichTextElement): type = "color" @property def attributes(self) -> Set[str]: # type: ignore[override] - return super().attributes.union({"value"}) + return super().attributes.union({"value", "style"}) def __init__( self, *, value: str, + style: Optional[Union[dict, "RichTextElementParts.TextStyle"]] = None, **others: dict, ): super().__init__(type=self.type) show_unknown_key_warning(self, others) self.value = value + self.style = style