Skip to content

Conversation

@UziTech
Copy link
Member

@UziTech UziTech commented Apr 4, 2018

Marked version: 0.3.19

Description

  • Sets the Renderer options to the default options by default

I'm not sure if there is a reason the Renderer options were set to an empty object instead of the default options. The Parser and Lexers are set to the default options already

function Renderer(options) {
  this.options = options || {};
  ...
function Lexer(options) {
  this.options = options || marked.defaults;
  ...
function InlineLexer(links, options) {
  this.options = options || marked.defaults;
  ...
function Parser(options) {
  this.options = options || marked.defaults;
  ...

Contributor

  • Test(s) exist to ensure functionality and minimize regression (if no tests added, list tests covering this PR); or,
  • no tests required for this PR.

Committer

In most cases, this should be a different person than the contributor.

  • Draft GitHub release notes have been updated.
  • CI is green (no forced merge required).
  • Merge PR

@UziTech UziTech requested review from joshbruce and styfle April 4, 2018 19:36
@UziTech
Copy link
Member Author

UziTech commented Apr 4, 2018

@Feder1co5oave is there any reason Renderer options would be set to an empty object instead of the marked.defaults?

Copy link
Member

@styfle styfle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's odd, maybe it was a miss?
This probably should use the defaults.

This is a breaking change for anyone using var r = new Renderer(), right?

@UziTech
Copy link
Member Author

UziTech commented Apr 4, 2018

Yes it would be a breaking change but I feel like it would be a fix. Right now that would be the same as the following:

var r = new Renderer({
  baseUrl: undefined,
  breaks: undefined,
  gfm: undefined,
  headerIds: undefined,
  headerPrefix: undefined,
  highlight: undefined,
  langPrefix: undefined,
  mangle: undefined,
  pedantic: undefined,
  renderer: undefined,
  sanitize: undefined,
  sanitizer: undefined,
  silent: undefined,
  smartLists: undefined,
  smartypants: undefined,
  tables: undefined,
  xhtml: undefined
});

which I don't think anyone would do willingly. So it would be more likely that anyone using the renderer would pass some options so this wouldn't break anything.

Copy link
Member

@joshbruce joshbruce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would want to make sure our next release is 0.4.x due to the breaking change, but I think the options need some work anyway given what I've seen so far...might be a good place to start stabilizing things.

@joshbruce
Copy link
Member

ps. Just because this is a breaking change doesn't stop me from merging this. If neither @UziTech or @styfle are concerned committing to a 0.4.x as the next release, I would say we are good to go.

@UziTech
Copy link
Member Author

UziTech commented Apr 5, 2018

Ya I would say we should merge it as a bug fix and release when 0.4.x milestone is ready. I was looking through the blame and it looks like it was just missed when the renderer was created.

@joshbruce joshbruce mentioned this pull request Apr 5, 2018
4 tasks
@styfle styfle added this to the 0.4.0 - No known defects milestone Apr 5, 2018
@styfle styfle merged commit f4387f8 into markedjs:master Apr 5, 2018
@styfle
Copy link
Member

styfle commented Apr 5, 2018

Done

@Feder1co5oave
Copy link
Contributor

Because of lines 549 and 980. It gets overwritten anyways,

zhenalexfan pushed a commit to zhenalexfan/MarkdownHan that referenced this pull request Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants