mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-11 13:48:40 +00:00
fix: autocomplete / tooltip code example bug
This commit is contained in:
parent
b52cb198b5
commit
7157634db0
@ -3,6 +3,12 @@ import jsdoc from '../../doc.json';
|
|||||||
import { autocompletion } from '@codemirror/autocomplete';
|
import { autocompletion } from '@codemirror/autocomplete';
|
||||||
import { h } from './html';
|
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 getDocLabel = (doc) => doc.name || doc.longname;
|
||||||
const getInnerText = (html) => {
|
const getInnerText = (html) => {
|
||||||
var div = document.createElement('div');
|
var div = document.createElement('div');
|
||||||
@ -21,7 +27,7 @@ ${doc.description}
|
|||||||
)}
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
<div>
|
<div>
|
||||||
${doc.examples?.map((example) => `<div><pre>${example}</pre></div>`)}
|
${doc.examples?.map((example) => `<div><pre>${plaintext(example)}</pre></div>`)}
|
||||||
</div>
|
</div>
|
||||||
</div>`[0];
|
</div>`[0];
|
||||||
/*
|
/*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user