diff --git a/src/generate/__tests__/fixtures/contributors.json b/src/generate/__tests__/fixtures/contributors.json
index 7ede43c..ff4a1c4 100644
--- a/src/generate/__tests__/fixtures/contributors.json
+++ b/src/generate/__tests__/fixtures/contributors.json
@@ -34,5 +34,12 @@
"name": "Wildly Misconfigured",
"avatar_url": "https://avatars1.githubusercontent.com/u/1500684",
"contributions": ["plumbis"]
+ },
+ "name_with_quotes": {
+ "login": "namelastname",
+ "name": "Name \"Nickname\" Lastname",
+ "avatar_url": "https://avatars1.githubusercontent.com/u/1500684",
+ "profile": "http://github.com/namelastname",
+ "contributions": ["doc"]
}
}
diff --git a/src/generate/__tests__/format-contributor.js b/src/generate/__tests__/format-contributor.js
index c158cb3..e9ebde8 100644
--- a/src/generate/__tests__/format-contributor.js
+++ b/src/generate/__tests__/format-contributor.js
@@ -87,3 +87,12 @@ test('format contributor with no complete name', () => {
expect(formatContributor(options, contributor)).toBe(expected)
})
+
+test('format contributor with quotes in name', () => {
+ const contributor = contributors.name_with_quotes
+ const {options} = fixtures()
+
+ const expected =
+ '
Name "Nickname" Lastname
📖'
+ expect(formatContributor(options, contributor)).toBe(expected)
+})
diff --git a/src/generate/format-contributor.js b/src/generate/format-contributor.js
index 9f489f4..5a86e83 100644
--- a/src/generate/format-contributor.js
+++ b/src/generate/format-contributor.js
@@ -44,7 +44,9 @@ function defaultTemplate(templateData) {
}
function escapeName(name) {
- return name.replace(new RegExp('\\|', 'g'), '|')
+ return name
+ .replace(new RegExp('\\|', 'g'), '|')
+ .replace(new RegExp('\\"', 'g'), '"')
}
module.exports = function formatContributor(options, contributor) {