iby / twig-js-markdown

Markdown extension for twig.js
8 stars 2 forks source link

Changing marked options #1

Closed chrisvanpatten closed 5 years ago

chrisvanpatten commented 7 years ago

Hello!

I'm curious if it's possible to supply options for Marked, perhaps as a second parameter on the extend method or something like that. (I'd like to enable support for smartypants formatting, which is off by default in the Marked processor, although the functionality is built in.)

Thanks :)

iby commented 7 years ago

I'll look into this towards the end of week, but if you can PR it would be awesome. Can you post a few examples of the final syntax that you have in mind?

chrisvanpatten commented 7 years ago

I'm pretty new to TypeScript but I'll hack around and see if I can come up with something.

I guess I would see it being something like this…

twig({
  extend: function (Twig) {
    twigMarkdown(Twig, {
      markedOptions: {
        smartypants: true
      }
    })
  }
})
langy commented 5 years ago

Thanks for adding this in @ianbytchek, I've just pulled down the latest version and tried passing the options in to turn off header IDs, but it doesn't seem to work :(

This is the code block I'm using in my gulpfile:

.pipe(twig({data: {}, extend: function(Twig) {
    twigMarkdown(Twig, {
        options: {
            headerIds: false
        }
    })
}}))
iby commented 5 years ago

Should options be wrapped into another object? Have you tried passing it as a plain { headerIds: false } object?

langy commented 5 years ago

Knew it would be something simple 😄thanks man, that worked!