From c0c60d855d469a0bbbd5227131b8cc6183a752f8 Mon Sep 17 00:00:00 2001 From: Ray East Date: Tue, 30 Jun 2020 02:06:39 +0300 Subject: [PATCH] :sparkles: Add markdown support for Option.description --- CHANGELOG.md | 4 ++++ package.json | 8 ++++++-- src/bits/option.js | 8 ++++++-- tests/props/description.js | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7a5ba0..1c0db64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/package.json b/package.json index 3bde273..93a9ab5 100644 --- a/package.json +++ b/package.json @@ -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", @@ -36,7 +36,11 @@ "message-builder", "block-builder", "slack-block-builder", - "block-kit" + "block-kit", + "blocks", + "botkit", + "bolt", + "slack-bolt" ], "scripts": { "test": "jest", diff --git a/src/bits/option.js b/src/bits/option.js index e38e2dd..033563d 100644 --- a/src/bits/option.js +++ b/src/bits/option.js @@ -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); diff --git a/tests/props/description.js b/tests/props/description.js index fa1e3d6..4533440 100644 --- a/tests/props/description.js +++ b/tests/props/description.js @@ -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 [