Uh oh!
There was an error while loading. Please reload this page.
Disable heading IDs - #1190
Conversation
styfle
commented
Apr 1, 2018
You should also add this to the documentation so users are aware of this feature. |
UziTech
commented
Apr 2, 2018
You should always create new branches from master to avoid including changes from other PRs |
UziTech
left a comment
There was a problem hiding this comment.
This PR should only contain changes to lib/marked.js
joshbruce
commented
Apr 2, 2018
@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 |
joshbruce
commented
Apr 2, 2018
UziTech
left a comment
There was a problem hiding this comment.
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. |
UziTech
commented
Apr 2, 2018
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(){varrederer=newmarked.Renderer(marked.defaults);varheader=rederer.heading('test',1,'test');expect(header).toBe('<h1 id="test">test</h1>\n');});it('should ignore header ids',function(){varrederer=newmarked.Renderer({headerIds: false});varheader=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. |
| "glob-to-regexp": "0.3.0", | ||
| "html-differ": "^1.3.4", | ||
| "jasmine": "^3.1.0", | ||
| "jasmine2-custom-message": "^0.9.0", |
| 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.
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.
| var marked = require('../../marked.min.js'); | ||
| var HtmlDiffer = require('html-differ').HtmlDiffer, | ||
| htmlDiffer = new HtmlDiffer(); | ||
| var since = require('jasmine2-custom-message'); |
| breaks: false, | ||
| gfm: true, | ||
| headerPrefix: '', | ||
| headerIds: true, |
There was a problem hiding this comment.
Good catch...funny enough, I got it right in the table. :)
UziTech
left a comment
There was a problem hiding this comment.
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?
|
| "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.
Why are you updating dev dependencies? This should be in a different PR in my opinion.
| "showdown": "*", | ||
| "uglify-js": "^3.3.10" | ||
| "markdown-it": "^8.4.1", | ||
| "showdown": "^1.8.6", |
| "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", |
* 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.