Skip to content

Commit

Permalink
✨ Add markdown support for Option.description
Browse files Browse the repository at this point in the history
  • Loading branch information
raycharius committed Jun 29, 2020
1 parent bbc8e7f commit c0c60d8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## v1.3.1 – 2020-06-30

* Add support for markdown for the `description` property of the `Options` `Bit` object.

## v1.2.1 – 2020-06-27

* Fix issue where Slack timestamp format not permitted for `ts` and `threadTs` parameters of the `Message` surface object.
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "slack-block-builder",
"version": "1.2.1",
"version": "1.3.1",
"description": "Maintainable code for interactive Slack messages, modals and home tabs. A must-have for the Slack Block Kit framework.",
"author": {
"name": "Ray East",
Expand Down Expand Up @@ -36,7 +36,11 @@
"message-builder",
"block-builder",
"slack-block-builder",
"block-kit"
"block-kit",
"blocks",
"botkit",
"bolt",
"slack-bolt"
],
"scripts": {
"test": "jest",
Expand Down
8 changes: 6 additions & 2 deletions src/bits/option.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,12 @@ class Option extends Bit {

build({ isMarkdown } = { isMarkdown: false }) {
const augmentedProps = {
text: isMarkdown ? BuilderHelper.getMarkdownObject(this.props.text) : BuilderHelper.getPlainTextObject(this.props.text),
description: BuilderHelper.getPlainTextObject(this.props.description),
text: isMarkdown
? BuilderHelper.getMarkdownObject(this.props.text)
: BuilderHelper.getPlainTextObject(this.props.text),
description: isMarkdown
? BuilderHelper.getMarkdownObject(this.props.description)
: BuilderHelper.getPlainTextObject(this.props.description),
};

return this.getResult(OptionDto, augmentedProps);
Expand Down
2 changes: 1 addition & 1 deletion tests/props/description.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = (params) => {
method: props.description,
property: props.description,
param: paramMap.description,
mutated: types.PlainTextObject,
mutated: params.expectMarkdown ? types.MarkdownObject : types.PlainTextObject,
};

return [
Expand Down

0 comments on commit c0c60d8

Please sign in to comment.