Skip to content

Commit 5ec6735

Browse files
authored
Display tooltip content as html (#1685)
Closes #1639
1 parent f71fbc2 commit 5ec6735

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

assets/js/handlebars/templates/tooltip-body.handlebars

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</div>
1212
{{#if this.hint.description}}
1313
<section class="docstring">
14-
{{this.hint.description}}
14+
{{{this.hint.description}}}
1515
</section>
1616
{{/if}}
1717
{{/if}}

assets/js/tooltips/hints.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export function extractFunctionHint (element) {
154154
const title = heading.textContent
155155

156156
const firstParagraph = element.querySelector('.docstring > p')
157-
const description = firstParagraph ? firstParagraph.textContent : ''
157+
const description = firstParagraph ? firstParagraph.innerHTML : ''
158158

159159
return {
160160
kind: HINT_KIND.function,
@@ -174,7 +174,7 @@ export function extractModuleHint (content) {
174174
const title = heading.textContent
175175

176176
const firstParagraph = content.querySelector('#moduledoc p')
177-
const description = firstParagraph ? firstParagraph.textContent : ''
177+
const description = firstParagraph ? firstParagraph.innerHTML : ''
178178

179179
return {
180180
kind: HINT_KIND.module,

assets/test/tooltips/hints.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('hints extraction', () => {
2828

2929
it('extracts hint info', () => {
3030
expect(extractModuleHint(modulePageObject).title).to.eql('Some module')
31-
expect(extractModuleHint(modulePageObject).description).to.eql('Module description here')
31+
expect(extractModuleHint(modulePageObject).description).to.eql('Module <strong>description</strong> here')
3232
expect(extractModuleHint(modulePageObject).kind).to.eql('module')
3333
})
3434
})

0 commit comments

Comments
 (0)