Skip to content

Commit

Permalink
Merge pull request #898 from tidalcycles/fix-autocomplete
Browse files Browse the repository at this point in the history
fix: autocomplete / tooltip code example bug
  • Loading branch information
felixroos committed Jan 10, 2024
2 parents b52cb19 + 7157634 commit f768e1e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/codemirror/autocomplete.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ import jsdoc from '../../doc.json';
import { autocompletion } from '@codemirror/autocomplete';
import { h } from './html';

function plaintext(str) {
const div = document.createElement('div');
div.innerText = str;
return div.innerHTML;
}

const getDocLabel = (doc) => doc.name || doc.longname;
const getInnerText = (html) => {
var div = document.createElement('div');
Expand All @@ -21,7 +27,7 @@ ${doc.description}
)}
</ul>
<div>
${doc.examples?.map((example) => `<div><pre>${example}</pre></div>`)}
${doc.examples?.map((example) => `<div><pre>${plaintext(example)}</pre></div>`)}
</div>
</div>`[0];
/*
Expand Down

0 comments on commit f768e1e

Please sign in to comment.