mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
ui: select closest sample output (#634)
This commit is contained in:
1 parent
20fe72a708
commit
45c5642db3
1 file changed
+2
-1
@@ -17,12 +17,13 @@ const highlighterPage = new AutoloadPage('highlighterPage', () => {
|
||||
$container.find('pre code').get().forEach((code) => {
|
||||
const $code = $(code);
|
||||
const $root = $code.parent().parent();
|
||||
const $typo = $code.closest('.typo');
|
||||
const language = ($(code).attr('class') || '').trim();
|
||||
const m = language.match(/language-input([0-9]+)/);
|
||||
if (m?.[1]) {
|
||||
const id = +m[1];
|
||||
if (Number.isSafeInteger(id)) {
|
||||
const $output = $container.find(`pre.language-output${id}`);
|
||||
const $output = ($typo.length ? $typo : $container).find(`pre.language-output${id}`);
|
||||
if ($output.length) {
|
||||
const $c = $(document.createElement('div')).addClass('row');
|
||||
$root.after($c);
|
||||
|
||||
Reference in new issue
Block a user