Skip to content
This repository was archived by the owner on Dec 30, 2022. It is now read-only.

Commit 7f30331

Browse files
authored
fix(Snippet): switch tag replacement to mark (#729)
Fixes #727
1 parent e3c1ef6 commit 7f30331

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/components/Snippet.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ export default {
4141
'See https://www.algolia.com/doc/api-reference/api-parameters/attributesToSnippet/.'
4242
);
4343
}
44+
4445
return attributeValue
4546
.replace(
46-
new RegExp('<em>', 'g'),
47+
new RegExp('<mark>', 'g'),
4748
`<${this.highlightedTagName} class="${this.suit('highlighted')}">`
4849
)
49-
.replace(new RegExp('</em>', 'g'), `</${this.highlightedTagName}>`);
50+
.replace(new RegExp('</mark>', 'g'), `</${this.highlightedTagName}>`);
5051
},
5152
},
5253
};

src/components/__tests__/Snippet.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ test('renders proper HTML', () => {
99
const hit = {
1010
_snippetResult: {
1111
attr: {
12-
value: `con<em>ten</em>t`,
12+
value: `con<mark>ten</mark>t`,
1313
},
1414
},
1515
};
@@ -28,7 +28,7 @@ test('renders proper HTML with highlightTagName', () => {
2828
const hit = {
2929
_snippetResult: {
3030
attr: {
31-
value: `con<em>ten</em>t`,
31+
value: `con<mark>ten</mark>t`,
3232
},
3333
},
3434
};
@@ -83,7 +83,7 @@ test('allows usage of dot delimited path to access nested attribute', () => {
8383
_snippetResult: {
8484
attr: {
8585
nested: {
86-
value: `nested <em>val</em>`,
86+
value: `nested <mark>val</mark>`,
8787
},
8888
},
8989
},

0 commit comments

Comments
 (0)