question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow `verbatim={boolean}` parameter

See original GitHub issue

For 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:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
yhattcommented, Jan 10, 2020

#97 was merged but <Mrkdwn> for <Field> component would not be worked. Re-open issue.

0reactions
yhattcommented, Dec 17, 2019

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}>.

<Blocks>
  <Section>Hello!</Section>
</Blocks>

It means the same as below:

<Blocks>
  <Section>
    <Mrkdwn verbatim={true}>Hello!</Mrkdwn>
  </Section>
</Blocks>

An explicitly declared <Mrkdwn> component means using text composition object with customized attributes.

<Blocks>
  <Section>
    <Mrkdwn verbatim={false}>Hello!</Mrkdwn>
  </Section>
</Blocks>

The JSX structure becomes similar as the original JSON structure defined by Slack. For example, below block elements are valid all.

<Blocks>
  <Section>
    <Mrkdwn verbatim={false}>
      Hello!
    </Mrkdwn>
  </Section>
  <Section>
    <Field>
      <Mrkdwn verbatim={false}>
        Hello!
      </Mrkdwn>
    </Field>
  </Section>
  <Context>
    <Mrkdwn verbatim={false}>
      Hello!
    </Mrkdwn>
  </Context>
  <Actions>
    <Button confirm={
      <Confirm title="Commit your action" confirm="Yes, please" deny="Cancel">
        <Mrkdwn verbatim={false}>
          Are you sure?
        </Mrkdwn>
      </Confirm>
    }>
      Button
    </Button>
  </Actions>
</Blocks>

And the outputted JSON is this:

[
  {
    "type": "section",
    "text": {
      "text": "Hello!",
      "type": "mrkdwn",
      "verbatim": false
    }
  },
  {
    "type": "section",
    "fields": [
      {
        "type": "mrkdwn",
        "text": "Hello!",
        "verbatim": false
      }
    ]
  },
  {
    "type": "context",
    "elements": [
      {
        "type": "mrkdwn",
        "text": "Hello!",
        "verbatim": false
      }
    ]
  },
  {
    "type": "actions",
    "elements": [
      {
        "type": "button",
        "text": {
          "type": "plain_text",
          "text": "Button",
          "emoji": true
        },
        "confirm": {
          "title": {
            "type": "plain_text",
            "text": "Commit your action",
            "emoji": true
          },
          "text": {
            "type": "mrkdwn",
            "text": "Are you sure?",
            "verbatim": false
          },
          "confirm": {
            "type": "plain_text",
            "text": "Yes, please",
            "emoji": true
          },
          "deny": {
            "type": "plain_text",
            "text": "Cancel",
            "emoji": true
          }
        }
      }
    ]
  }
]
Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow `verbatim={boolean}` parameter · Issue #73 - GitHub
For text objects, Slack allows a parameter verbatim to be passed, allowing some elements to be parsed by slack, ... Allow verbatim={boolean} parameter...
Read more >
Verbatim Text Inside Environment which is inside a Boolean ...
where the solution environment is created with the NewEnviron package as I want to display the solution depending on an if statement. However, ......
Read more >
How to pass boolean variable of false in a URL - Stack Overflow
URLs are strings and all values in a URL are strings. When you see i=0 in a URL, 0 is a string. When...
Read more >
Why doesn't verbatim work within - The TeX FAQ
This is why the LaTeX book insists that verbatim commands must not appear in the argument of any other command; they aren't just...
Read more >
What is wrong with boolean parameters?
A boolean argument indicates the function has 2 different behaviors. These 2 behaviors are probably tangled together. And this just calls for more....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found