easyBlockKitGenerator
code:script.js
export const em = text => _${text}_;
export const strong = text => *${text}*;
export const strike = text => ~${text}~;
export const br = '\n';
export const p = text => \n${text}\n;
export const blockquote = text => > ${text};
export const code = text => \`${text}\`;
export const pre = text => \`\`\`${text}\`\`\`;
export const a = ({href}, text) => <${href}${text ? |${text} : ''}>;
export const hr = {type: 'divider'};
export const blocks = (...items) => {return {blocks: items};};
export const header = (text) => {
return {
type: 'header',
text: plain_text(text),
};
}
export const section = (text, {plain = false} = {}) => {
return {
type: 'section',
text: plain ? plain_text(text) : mrkdwn(text),
};
};
export const context = (...elements) => {
return {
type: 'context',
elements,
};
};
export const mrkdwn = (text, {verbatim = true} = {}) => {
return {
type: 'mrkdwn',
text,
verbatim,
};
};
export const plain_text = (text, {emoji = true} = {}) => {
return {
type: 'plain_text',
text,
emoji,
};
};
export const image = (url, alt_text) => {
return {
type: 'image',
url,
...(alt_text ? {alt_text} : {}),
};
};