Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start ordered lists using the initial numbers from markdown lists #1144

Merged
merged 4 commits into from Mar 21, 2018

Conversation

Projects
None yet
4 participants
@paulroub
Copy link
Contributor

commented Mar 15, 2018

Adds tests for list creation and continuation when starting with a
number other than 1.

Emits 'start' attribute only when necessary; simple cases behave as
always.

Marked version: 0.3.17

Markdown flavor: CommonMark

Description

Contributor

  • Test(s) exist to ensure functionality and minimize regresstion (if no tests added, list tests covering this PR); or,
  • no tests required for this PR.
  • If submitting new feature, it has been documented in the appropriate places.

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
Start ordered lists using the initial numbers from markdown lists
Adds tests for list creation and continuation when starting with a
number other than 1.

Emits 'start' attribute only when necessary; simple cases behave as
always.
@joshbruce

This comment has been minimized.

Copy link
Member

commented Mar 20, 2018

@paulroub: Thanks again for this contribution!

We've started moving toward using Jasmine for our test harness. We are also looking to stick as close we can to objective examples from the specifications themselves. There are two entries in the CommonMark spec that seem be related to this issue. Would you be willing and able to create tests for these two examples using the proposed solution?

http://spec.commonmark.org/0.28/#example-230 - starting at 0 results in a forced starting number.

http://spec.commonmark.org/0.28/#example-234 - start at 10 and have a code block within a list item.

If you can add a test in /test/integration/marked-spec.js file it will help us determine where marked is objectively failing against the spec instead of any one of our interpretations of it. Tagging @UziTech to help with any test harness questions.

@joshbruce

This comment has been minimized.

Copy link
Member

commented Mar 20, 2018

ps. Please keep the tests you have (or copy and paste from the spec to update html and MD files).

paulroub added some commits Mar 20, 2018

Added integration tests for explicitly-initialized ordered lists.
Fixed a bug in the initial implementation of ordered-list
initialization.

Add a simpler unit test around starting-from-zero.

@joshbruce joshbruce requested review from UziTech and styfle Mar 20, 2018

@joshbruce

This comment has been minimized.

Copy link
Member

commented Mar 20, 2018

@paulroub: This looks good to me. Having said that, I would like to get a second and possibly a third pair of eyes. Thank you so much!

return '<' + type + '>\n' + body + '</' + type + '>\n';
Renderer.prototype.list = function(body, ordered, start) {
var type = ordered ? 'ol' : 'ul',
startatt = (ordered && +start !== 1) ? (' start="' + start + '"') : '';

This comment has been minimized.

Copy link
@styfle

styfle Mar 20, 2018

Member

Why are you casting +start here? Isn't it already a number from +bull above?

@styfle

styfle approved these changes Mar 21, 2018

@styfle styfle requested a review from joshbruce Mar 21, 2018

@joshbruce
Copy link
Member

left a comment

LGTM! Merging. Thanks for the reviews everyone and the well-formed submission.

@joshbruce joshbruce merged commit 5d3d70a into markedjs:master Mar 21, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@paulroub paulroub deleted the paulroub:OL_initial_numbers branch Mar 21, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.