question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot set `marked` options

See original GitHub issue

I’d like to set custom options as shown in the marked documentation e.g.:

marked.setOptions({
  breaks: false
});

Which makes single line breaks into <br>s instead of the normal md behaviour of just adding a space (i.e. treating this as a line continuation).

Right now, I can hack this by just adding my desired call to setOptions at the top of markdown.component.js, but would prefer to have an option per component instance.

Any plans to add setting of custom marked options? Happy to help with preparing a PR with an attempt if this is useful.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jfcerecommented, Dec 22, 2017

Hi guys, I like your ideas and where this is heading!

I started a PR for v1.5 to expose the renderer and allow marked options to be specified when loading the module.

This will be a step forward to add the markedOptions as an input binding for the component, which would allow to override the options set on the module for a specific instance when provided (more flexibility).

I only have to fix JavaScript transpile process with rollup + update the readme.md and I’ll do the release somewhere early next week.

0reactions
jfcerecommented, Jan 15, 2018

Closing for now but feel free to reopen if you feel v1.5.0 does not provide what you need.

Read more comments on GitHub >

github_iconTop Results From Across the Web

setOptions - Marked Documentation
Called when markdownString has been parsed. Can be used as second argument if no options present. Alternative using reference. // Create reference instance ......
Read more >
Renderer not merged when used in marked() options #2082
After looking at the source code, it does not seem like the renderer is "merged into" anything when passed directly to marked() ....
Read more >
How to have more instances of marked js in one project?
My problem, which I cannot overcome is that I cannot achieve a state where I have 2 parallel instances oh markedjs which work...
Read more >
marked
String of markdown source to be compiled. options. Type: object. Hash of options. Can also be set using the marked.setOptions method as seen...
Read more >
marked/README.md - UNPKG
1, # marked. 2. 3, > A full-featured markdown parser and compiler, written in JavaScript. Built. 4, > for speed. 5. 6, [![...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found