-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Disable heading IDs #1190
Merged
+59
−33
Merged
Disable heading IDs #1190
Changes from 2 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8b60260
Cannot set options
3d7788b
Updated min
e4f2f81
Alphabetize and add options to docs
83806c0
Make unit tests
c57dff5
Merge branch 'master' into optional-heading-ids
joshbruce abfe340
Fix lint and remove intergration test
84a3c29
Merge branch 'optional-heading-ids' of https://github.com/8fold/marke…
a67c8f6
Post review
12976eb
revert integration test file
UziTech 7872103
Update package
cc0d396
Refresh package-lock
7c87d53
Trying to roll back package.json
eb778b9
revert package-lock.json
UziTech deff402
revert marked.min.js
UziTech 0fc7160
revert marked.min.js
UziTech File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
var marked = require('../../marked.min.js'); | ||
var HtmlDiffer = require('html-differ').HtmlDiffer, | ||
htmlDiffer = new HtmlDiffer(); | ||
var since = require('jasmine2-custom-message'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are not needed |
||
|
||
it('should run the test', function () { | ||
expect(marked('Hello World!')).toBe('<p>Hello World!</p>\n'); | ||
|
@@ -16,3 +19,45 @@ it('indents code within an explicitly-started ordered list', function () { | |
expect(marked(" 10. foo\n\n bar")). | ||
toBe("<ol start=\"10\">\n<li><p>foo</p>\n<pre><code>bar\n</code></pre></li>\n</ol>\n"); | ||
}); | ||
|
||
// it('should be able to change options', function() { | ||
// marked.setOptions({ headerIds: false }); | ||
// since(JSON.stringify(marked.options)).expect(marked.options.headerIds).toBe(false); | ||
// }); | ||
|
||
it('should add header ID by default', function () { | ||
marked.setOptions({ headerIds: true }); | ||
|
||
var markdown = '# hello'; | ||
var expected = '<h1 id="hello">hello</h1>'; | ||
var actual = marked(markdown); | ||
|
||
var message = 'Default options adds header id:\n' | ||
+ markdown | ||
+ '\n------\n\nExpected:\n' + expected | ||
+ '\n------\n\nMarked:\n' + actual; | ||
|
||
var diff = htmlDiffer.isEqual(expected, actual); | ||
|
||
since(message).expect(diff).toBe(true); | ||
|
||
}); | ||
|
||
it('should NOT add header ID when option is false', function () { | ||
marked.setOptions({ headerIds: false }); | ||
|
||
var markdown = '# hello'; | ||
var expected = '<h1>hello</h1>'; | ||
var actual = marked(markdown); | ||
|
||
var message = 'Custom options does NOT adds header id:\n' | ||
+ markdown | ||
+ '\n------\n\nExpected:\n' + expected | ||
+ '\n------\n\nMarked:\n' + actual + '\n\n' | ||
+ JSON.stringify(marked.options); | ||
|
||
var diff = htmlDiffer.isEqual(expected, actual); | ||
|
||
since(message).expect(diff).toBe(true); | ||
|
||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are not needed for this PR