Skip to content

use default options in Renderer by default - #1203

Merged
styfle merged 1 commit into
markedjs:masterfrom
UziTech:UziTech-patch-1
Apr 5, 2018
Merged

use default options in Renderer by default#1203
styfle merged 1 commit into
markedjs:masterfrom
UziTech:UziTech-patch-1

Conversation

@UziTech

@UziTechUziTech commented Apr 4, 2018

Copy link
Copy Markdown
Member

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

functionRenderer(options){this.options=options||{};
...
functionLexer(options){this.options=options||marked.defaults;
...
functionInlineLexer(links,options){this.options=options||marked.defaults;
...
functionParser(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 styfleApril 4, 2018 19:36
@UziTech

Copy link
Copy Markdown
MemberAuthor

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

@styflestyfle left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
MemberAuthor

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:

varr=newRenderer({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.

@joshbrucejoshbruce left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
MemberAuthor

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.

@joshbrucejoshbruce mentioned this pull request Apr 5, 2018
4 tasks
@styflestyfle added this to the 0.4.0 - No known defects milestone Apr 5, 2018
@styfle
styfle merged commit f4387f8 into markedjs:masterApr 5, 2018
@styfle

Copy link
Copy Markdown
Member

Done

@Feder1co5oave

Copy link
Copy Markdown
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 freeto 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

@UziTech@joshbruce@styfle@Feder1co5oave