-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add MrkDwn component #97
Conversation
CI looks like failing by incorrect format. Could you execute |
docs/layout-blocks.md
Outdated
@@ -239,6 +239,24 @@ If you want to use `<Input>` as layout block, you have to place one of [availabl | |||
|
|||
`<Input>` component for layout block is provided for user that want templating with Slack API style rather than HTML style. | |||
|
|||
## <a name="mrkdwn_component" id="mrkdwn_component"></a> [`<MrkDwn>`: Verbatim Block](https://api.slack.com/reference/block-kit/composition-objects#text) (Only for <Section> and <Context> blocks) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<Mrkdwn>
is a part of text composition object and not layout blocks. We have to match a kind of element with Slack.
The documentation of <Mrkdwn>
should place into "Composition objects" section in docs/block-elements.md
.
As a same reason, moving 👈Done.src/block-kit/MrkDwn.tsx
to src/block-kit/composition/Mrkdwn.tsx
would be better.
src/block-kit/composition/Mrkdwn.tsx
Outdated
} | ||
|
||
export const Mrkdwn: JSXSlack.FC<MrkdwnProps & { | ||
children: JSXSlack.Children<BlockComponentProps> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated definition.
src/block-kit/composition/Mrkdwn.tsx
Outdated
import { BlockComponentProps } from '../Blocks' | ||
|
||
interface MrkdwnProps extends BlockComponentProps { | ||
children: JSXSlack.Children<BlockComponentProps> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<Mrkdwn>
component would not take block components as children. It would be better to take JSXSlack.Children<{}>
as same as children in <Section>
and <Context>
.
src/block-kit/composition/Mrkdwn.tsx
Outdated
|
||
interface MrkdwnProps extends BlockComponentProps { | ||
children: JSXSlack.Children<BlockComponentProps> | ||
verbatim: boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI according to Slack API document, verbatim
field is optional. Following this for user that wants to define JSON for Slack API exactly is good.
src/block-kit/composition/Mrkdwn.tsx
Outdated
import html from '../../html' | ||
import { BlockComponentProps } from '../Blocks' | ||
|
||
interface MrkdwnProps extends BlockComponentProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't extend BlockComponentProps
. It includes blockId
prop (and id
alias prop) for layout blocks, and <Mrkdwn>
composition object is not a part of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About documentation...
docs/block-elements.md
Outdated
@@ -633,6 +633,22 @@ As same as `<Input type="hidden">`, `submit` prop in `<Modal>` must not define w | |||
|
|||
It's exactly same as [`<Input>` component](#input-props), except `type` prop. | |||
|
|||
## <a name="mrkdwn_component" id="mrkdwn_component"></a> [`<Mrkdwn>`: Markdown Composition Component](https://api.slack.com/reference/block-kit/composition-objects#text) | |||
|
|||
Mrkdwn is a text composition component is used when its needed to have a Text object and explicitly set the `verbatim` property. Setting `verbatim` to false will tell Slack to auto-convert links, conversaion names, and certain mentions to be linkified and automatically parsed. If `verbatim` set to true Slack will skip any prepreprocessing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can understand the use case well, but as our position, we cannot recommend using verbatim=false
to enable automatic parsing because Slack is making clear a possibility of deprecating gradually in future.
We think verbatim
attribute is like an escape hatch for the traditional Slack app. jsx-slack has already take verbatim=true
as a default option even if not using <Mrkdwn>
composition object. So we don't want to use this by users who will create new app with jsx-slack.
Thus, we should make clear these intents within this document.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@javaPhil Thanks for your work! We want to release jsx-slack v1 with including <Mrkdwn>
component. Could you resolve conflict and the reviewed documentation?
docs/block-elements.md
Outdated
@@ -633,6 +633,24 @@ As same as `<Input type="hidden">`, `submit` prop in `<Modal>` must not define w | |||
|
|||
It's exactly same as [`<Input>` component](#input-props), except `type` prop. | |||
|
|||
## <a name="mrkdwn_component" id="mrkdwn_component"></a> [`<Mrkdwn>`: Markdown Composition Component](https://api.slack.com/reference/block-kit/composition-objects#text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added documentation should be in a section of "Composition objects" (https://github.com/speee/jsx-slack/blob/master/docs/block-elements.md#composition-objects).
Please move it to below <Confirm>
/ right above ## Input components for modal
, and demote each headings one level (##
-> ###
, ###
-> ####
).
Resolves #73
Added
<MrkDwn>
component and added logic to<Section>
and<Context>
blocks to handle<MrkDwn>
component.You can now use
<MrkDwn>
in a<Section>
blockwhich converts to
or a
<Context>
blockwhich converts to