tryfabric / mack Goto Github PK
View Code? Open in Web Editor NEWMarkdown To Slack: Convert Markdown and GitHub Flavoured Markdown to Slack BlockKit block objects ๐๐ฌ
License: MIT License
Markdown To Slack: Convert Markdown and GitHub Flavoured Markdown to Slack BlockKit block objects ๐๐ฌ
License: MIT License
Discuss in #public-issue-9--consider-using-the-marked-library-instead-of-remarkhype-to-reduc
The package is ~350kb minified
It's a little big
Swap out dependencies for smaller ones
Discuss in #public-issue-6--truncate-text-to-fit-in-the-slack-api
What is the current functionality?
We don't truncate text in markdown blocks, headers, or image fields.
What problems are you facing with the current feature?
It's possible to send invalid blocks
What is your idea?
Truncate text to fit in the Slack API
markdownToBlocks(`
- asdf
- asdf2`)
Array [
Object {
"text": Object {
"text": "โข asdf",
"type": "mrkdwn",
},
"type": "section",
},
]
Array [
Object {
"text": Object {
"text": "โข asdf
โข asdf2",
"type": "mrkdwn",
},
"type": "section",
},
]
Discuss in #issue-2--support-markdown-tables
We don't currently support markdown tables, but we want to display them in some way, maybe within a code block.
I tested this package with examples,
But an error occured as below.
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'lexer')
at markdownToBlocks (index.ts:27:1)
export async function markdownToBlocks(
body: string,
options: ParsingOptions = {}
): Promise<KnownBlock[]> {
const tokens = marked.lexer(body); // error line
return parseBlocks(tokens, options);
}
I tried using the package in my component which uses React Quill. I am converting the HTML to markdown in my code to be passed down to this package. Generate markdown seems to be correct..
Among the formats /toolbar that i am using, only the blockquote for single line doesn't work. Rest of things work nicely!
function parseBlockquote(element: marked.Tokens.Blockquote): KnownBlock[] { return element.tokens .filter( (child): child is marked.Tokens.Paragraph => child.type === 'paragraph' ) .flatMap(p => parseParagraph(p).map(block => { if (isSectionBlock(block) && block.text?.text) { block.text.text = block.text.text .split('\n') .map(line => '> ' + line) .join('\n'); } return block; }) ); }
this fix works when i tried to fork the repo but then some other formats like bold/italic/strike fails..
Is it possible to fix the blockquote format in your repo?
The current implementation to resolve the raw markdown into a markdown AST is not that efficient currently, since we convert to and from HTML during the process. This can probably be improved so that only one lexing / tokenizing is needed.
Discuss in #issue-4--prints-null-at-top-of-code-blocks-with-no-language-specified
This sometimes creates a markdown block with null
at the top of code-blocks with no language specified.
Repro steps:
null
string at the topA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.