jsarafajr/slackify-markdown

heading (#) is no longer made *strong*

Closed this issue · 2 comments

Code snippet to reproduce (main.js):

const slackifyMarkdown = require('slackify-markdown')

const text = "#hello"

console.log(slackifyMarkdown(text))

It worked in version v2.1.0:

$ node main.js
*hello*

Then in v3.0.1 it's not working anymore:

$ node main.js
#hello

Tested with Node v10.20.1 and v12.18.2

I can't really see what changed in the code.

Hi, @BeyondEvil it looks like it's not anymore considered as a valid markdown by a library we use to parse markdown into the tree. https://github.com/remarkjs/remark/tree/main/packages/remark-parse

So # hello should work, but not #hello.

You can probably play around with remark-parse extensions to achieve the desired behaviour, it's possible to pass remark-parse options to slackifyMarkdown call, which will be passed down to remark-parse, which passes this to https://github.com/syntax-tree/mdast-util-from-markdown

const slackifyMarkdown = require('slackify-markdown')

const text = "#hello"

console.log(slackifyMarkdown(text, {
  extensions: ....
})

Ah, got it!

Thanks @jsarafajr ! 🙏

And yes, I verified that # hello was turned into *hello* with v3.1.0 👍