Skip to content

Commit

Permalink
Display tooltip content as html (#1685)
Browse files Browse the repository at this point in the history
Closes #1639
  • Loading branch information
leandrocp authored Mar 24, 2023
1 parent f71fbc2 commit 5ec6735
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion assets/js/handlebars/templates/tooltip-body.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</div>
{{#if this.hint.description}}
<section class="docstring">
{{this.hint.description}}
{{{this.hint.description}}}
</section>
{{/if}}
{{/if}}
4 changes: 2 additions & 2 deletions assets/js/tooltips/hints.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export function extractFunctionHint (element) {
const title = heading.textContent

const firstParagraph = element.querySelector('.docstring > p')
const description = firstParagraph ? firstParagraph.textContent : ''
const description = firstParagraph ? firstParagraph.innerHTML : ''

return {
kind: HINT_KIND.function,
Expand All @@ -174,7 +174,7 @@ export function extractModuleHint (content) {
const title = heading.textContent

const firstParagraph = content.querySelector('#moduledoc p')
const description = firstParagraph ? firstParagraph.textContent : ''
const description = firstParagraph ? firstParagraph.innerHTML : ''

return {
kind: HINT_KIND.module,
Expand Down
2 changes: 1 addition & 1 deletion assets/test/tooltips/hints.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('hints extraction', () => {

it('extracts hint info', () => {
expect(extractModuleHint(modulePageObject).title).to.eql('Some module')
expect(extractModuleHint(modulePageObject).description).to.eql('Module description here')
expect(extractModuleHint(modulePageObject).description).to.eql('Module <strong>description</strong> here')
expect(extractModuleHint(modulePageObject).kind).to.eql('module')
})
})
Expand Down

0 comments on commit 5ec6735

Please # to comment.