-
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
Disable heading IDs #1190
Conversation
You should also add this to the documentation so users are aware of this feature. |
You should always create new branches from master to avoid including changes from other PRs |
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.
This PR should only contain changes to lib/marked.js
@styfle: Updated documentation. Maybe I should make that a separate PR given the review from @UziTech. @UziTech: Believe it or not, I actually did branch off from |
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.
Sorry, I saw the integration tests and assumed you had included changes from #1160
I was thinking integration tests would be more for testing specs and making sure marked works in different environments. I think this should just require a unit test on the renderer.
@UziTech: Think I follow what you're asking, though not sure if I could do it easily. I'm adding this functionality to test the headers for CommonMark as none of the examples use IDs; so, the capability will be in the integration test suite at some point. Will see what I can do on the more unit-test side of the house. |
Ya that is fine if this option is used in the integration tests, but there is no need to have an integration test specifically for this feature. The way I see integration tests is if a feature needs to test multiple parts of the software (and possibly the platform) than it should have an integration test (e.g. spec tests need to test the whole application; lexing, parsing, and rendering) This feature only affects the rendering so it could be a unit test something like: it('should add header ids by default', function () {
var rederer = new marked.Renderer(marked.defaults);
var header = rederer.heading('test', 1, 'test');
expect(header).toBe('<h1 id="test">test</h1>\n');
});
it('should ignore header ids', function () {
var rederer = new marked.Renderer({ headerIds: false });
var header = rederer.heading('test', 1, 'test');
expect(header).toBe('<h1>test</h1>\n');
}); |
I believe we've covered all the comments and a little beyond.
If we merge this, I will close #1192 and #1193. Then I should be able to go back to #1160 to handle the failing header things, which should then only have things that are actually broken remaining. |
package.json
Outdated
"jasmine": "^3.1.0", | ||
"jasmine2-custom-message": "^0.9.0", |
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
test/unit/marked-spec.js
Outdated
|
||
describe('Test heading ID functionality', function() { | ||
it('should add id attribute by default', function() { | ||
var renderer = new sut.Renderer(sut.defaults); |
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.
Could we change sut
to something like markedUnderTest
or something like that? It feels very unintuitive that these defaults are coming from marked.
I feel like the only reason to distinguish the "system under test" is if we would need the same system not under test. (e.g. Jasmine testing Jasmine with Jasmine) I can't think of a reason we would ever need that.
test/integration/marked-spec.js
Outdated
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
These are not needed
lib/marked.js
Outdated
breaks: false, | ||
gfm: true, | ||
headerPrefix: '', | ||
headerIds: true, |
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.
'I' comes before 'P'
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.
Good catch...funny enough, I got it right in the table. :)
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.
You should remove the package-lock.json
changes.
Are we supposed to be including marked.min.js
changes in PRs? or is that supposed to wait for a release?
#1192 seems to duplicate a lot of these changes. Should we do those changes in this PR?
|
package.json
Outdated
"eslint": "^4.15.0", | ||
"eslint-config-standard": "^11.0.0-beta.0", | ||
"eslint-plugin-import": "^2.8.0", | ||
"eslint": "^4.19.1", |
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.
Why are you updating dev dependencies? This should be in a different PR in my opinion.
package.json
Outdated
"showdown": "*", | ||
"uglify-js": "^3.3.10" | ||
"markdown-it": "^8.4.1", | ||
"showdown": "^1.8.6", |
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.
Why are these updated?
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.
package-lock.json
Outdated
"version": "5.4.1", | ||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.4.1.tgz", | ||
"integrity": "sha512-XLmq3H/BVvW6/GbxKryGxWORz1ebilSsUDlyC27bXhWGWAZWkGwS6FLHjOlwFXNFoWFQEO/Df4u0YYd0K3BQgQ==", | ||
"version": "5.5.3", |
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.
Can you revert this file too?
* Add option to disable heading ids * Alphabetize and add options to docs
Marked version: 0.3.19
Markdown flavor: n/a
Description
PR adds functionality to disable header IDs.
This is also related to work being performed on #1160.
For some reason testing options does not work in isolation.
Contributor
Committer
In most cases, this should be a different person than the contributor.