Тесты и опросы: описания и пояснения в Markdown
- quizzes.description и описания вопросов рендерятся через WhatIDoMD.render на страницах прохождения и в списке (mdPlain для карточки) - Пояснения к вариантам — WhatIDoMD.inline - Системный промпт ИИ-генерации: description теста всегда в Markdown, пояснения по запросу - Стили .qz-desc / .qz-q-desc / .qp-desc (п, списки, код, таблицы, цитаты) - quizzes.html подключает js/md.js
This commit is contained in:
+10
-1
@@ -19,6 +19,15 @@
|
||||
return esc(String(s == null ? '' : s)).replace(/"/g, '"');
|
||||
}
|
||||
|
||||
function mdPlain(text) {
|
||||
const raw = String(text || '').trim();
|
||||
if (!raw) return '';
|
||||
if (typeof WhatIDoMD === 'undefined' || !WhatIDoMD || typeof WhatIDoMD.render !== 'function') return raw;
|
||||
const box = document.createElement('div');
|
||||
box.innerHTML = WhatIDoMD.render(raw);
|
||||
return (box.textContent || '').replace(/\s+/g, ' ').trim();
|
||||
}
|
||||
|
||||
function filters() {
|
||||
return {
|
||||
search: document.getElementById('quizSearch').value.trim(),
|
||||
@@ -68,7 +77,7 @@
|
||||
<div class="quiz-cover">${cover}<span class="quiz-kind-badge${q.kind === 'survey' ? ' survey' : ''}">${kindLabel(q.kind)}</span></div>
|
||||
<div class="quiz-body">
|
||||
<div class="quiz-title">${esc(q.title || 'Без названия')}</div>
|
||||
${q.description ? `<div class="quiz-desc">${esc(q.description)}</div>` : ''}
|
||||
${q.description ? `<div class="quiz-desc">${esc(mdPlain(q.description))}</div>` : ''}
|
||||
<div class="quiz-meta">
|
||||
<span>Вопросов: <b>${q.question_count}</b></span>
|
||||
<span>${attempts}</span>
|
||||
|
||||
Reference in New Issue
Block a user