Skip to content

Codespan newline - #1652

Merged
styfle merged 7 commits into
markedjs:masterfrom
UziTech:codespan-newline
May 3, 2020
Merged

Codespan newline#1652
styfle merged 7 commits into
markedjs:masterfrom
UziTech:codespan-newline

Conversation

@UziTech

@UziTech UziTech commented Apr 24, 2020

Copy link
Copy Markdown
Member

Marked version: v1.0.0

Description

Contributor

  • Test(s) exist to ensure functionality and minimize regression (if no tests added, list tests covering 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

@vercel

vercel Bot commented Apr 24, 2020

Copy link
Copy Markdown

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/markedjs/markedjs/lyg9hnduu
✅ Preview: https://markedjs-git-fork-uzitech-codespan-newline.markedjs.now.sh

Comment thread src/Lexer.js
if (token = this.tokenizer.text(src, tokens)) {
src = src.substring(token.raw.length);
tokens.push(token);
if (token.type) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

DRY? Same code added in two places?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That code is not really related so they could change independently.

@UziTech UziTech Apr 29, 2020

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't think we should combine that code into a function since it could change and need to be moved back anyway. This is one reason the best practice for DRY is to only combine code that needs to change together and only if it is in three or more places.

Rule of three

It states that two instances of similar code don't require refactoring, but when similar code is used three times, it should be extracted into a new procedure.

@styfle
styfle merged commit 0a57e47 into markedjs:master May 3, 2020
@UziTech UziTech mentioned this pull request May 16, 2020
12 tasks
@UziTech
UziTech deleted the codespan-newline branch June 17, 2020 17:54
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.

v1.0.0 newlines inside lists v1.0.0 does not respect multiline code spans in list items

3 participants