Skip to content

Commit 33a0897

Browse files
fix(core/ui): check if should inline markdown or not (#4040)
1 parent ae8db26 commit 33a0897

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/core/ui.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import { html, pluralize } from "./import-maps.js";
1212
import css from "../styles/ui.css.js";
1313
import { markdownToHtml } from "./markdown.js";
14+
import { reindent } from "./reindent.js";
1415
import { sub } from "./pubsubhub.js";
1516
export const name = "core/ui";
1617

@@ -266,10 +267,15 @@ function rsErrorToHTML(err) {
266267
const plugin = err.plugin
267268
? `<p class="respec-plugin">(plugin: "${err.plugin}")</p>`
268269
: "";
270+
269271
const hint = err.hint
270-
? `\n<p class="respec-hint"><strong>How to fix:</strong> ${markdownToHtml(
271-
err.hint,
272-
{ inline: true }
272+
? `\n${markdownToHtml(
273+
`<p class="respec-hint"><strong>How to fix:</strong> ${reindent(
274+
err.hint
275+
)}`,
276+
{
277+
inline: !err.hint.includes("\n"),
278+
}
273279
)}\n`
274280
: "";
275281
const elements = Array.isArray(err.elements)

src/core/xref.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,7 @@ function showErrors({ ambiguous, notFound }) {
456456
};
457457

458458
const howToFix = (howToCiteURL, originalTerm) => {
459-
return docLink`
460-
[See search matches for "${originalTerm}"](${howToCiteURL}) or
461-
${"[Learn about this error|#error-term-not-found]"}.`;
459+
return docLink`[See search matches for "${originalTerm}"](${howToCiteURL}) or ${"[Learn about this error|#error-term-not-found]"}.`;
462460
};
463461

464462
for (const { query, elems } of notFound.values()) {

0 commit comments

Comments
 (0)