-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(widget-markdown): don't add duplicate marks (#3290)
- Loading branch information
Showing
3 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
...etlify-cms-widget-markdown/src/serializers/__tests__/__fixtures__/issue_3280.md
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Fill to_*this*_mark, and your charge is but a penny; to_*this*_a penny more; and so on to the full glass—the Cape Horn measure, which you may gulp down for a shilling.\n\nUpon entering the place I found a number of young seamen gathered about a table, examining by a dim light divers specimens of_*skrimshander*. |
41 changes: 41 additions & 0 deletions
41
packages/netlify-cms-widget-markdown/src/serializers/__tests__/index.spec.js
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
import { markdownToSlate } from '../'; | ||
|
||
describe('markdownToSlate', () => { | ||
it('should handle use case from issue 3280', () => { | ||
const mdast = fs.readFileSync(path.join(__dirname, '__fixtures__', 'issue_3280.md')); | ||
const slate = markdownToSlate(mdast); | ||
|
||
expect(slate).toEqual({ | ||
object: 'block', | ||
type: 'root', | ||
nodes: [ | ||
{ | ||
object: 'block', | ||
type: 'paragraph', | ||
nodes: [ | ||
{ | ||
object: 'text', | ||
text: 'Fill to', | ||
}, | ||
{ | ||
object: 'text', | ||
text: | ||
'this_mark, and your charge is but a penny; tothisa penny more; and so on to the full glass—the Cape Horn measure, which you may gulp down for a shilling.\\n\\nUpon entering the place I found a number of young seamen gathered about a table, examining by a dim light divers specimens ofskrimshander', | ||
marks: [ | ||
{ | ||
type: 'italic', | ||
}, | ||
], | ||
}, | ||
{ | ||
object: 'text', | ||
text: '.', | ||
}, | ||
], | ||
}, | ||
], | ||
}); | ||
}); | ||
}); |
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