Allow `verbatim={boolean}` parameter
See original GitHub issueFor text objects, Slack allows a parameter verbatim
to be passed, allowing some elements to be parsed by slack, without needing specific mrkdwn syntax (e.g. channels, users, urls). From Slack’s doc on text object: https://api.slack.com/reference/block-kit/composition-objects#text
When set to false (as is default) URLs will be auto-converted into links, conversation names will be link-ified, and certain mentions will be automatically parsed. Using a value of true will skip any preprocessing of this nature, although you can still include manual parsing strings. This field is only usable when typeis mrkdwn.
It would be ideal to be able to use this attribute for components that support a text object (e.g. Section, Context, Fields (and pass them down to child elements). A specific use case where this would be ideal is rendering dynamic input in slack. If the dynamic content contains a URL, passing the text into a jsx-slack
component such as a <Button>
means you would first have to search for url’s and wrap them with <a>...</a>
to get them to render as links in Slack. Ideally you could opt into the verbatim
parameter to simply pass the raw text to Slack to parse
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
#97 was merged but
<Mrkdwn>
for<Field>
component would not be worked. Re-open issue.We’ve received a pull request in #97 so I have to share our deep thinking about
<Mrkdwn>
component for Slack’s text composition object.Current jsx-slack can think that the surface of HTML-like formatting is wrapped implicitly in
<Mrkdwn verbatim={true}>
.It means the same as below:
An explicitly declared
<Mrkdwn>
component means using text composition object with customized attributes.The JSX structure becomes similar as the original JSON structure defined by Slack. For example, below block elements are valid all.
And the outputted JSON is this: