From 296ce0e460c26f1a7bdd402601fd6efc67c04fee Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 3 Aug 2021 12:01:54 +0200 Subject: [PATCH] Simplify error hint when symbols are used outside of math mode (#4301) * Simplify error hint when symbols are used outside of math mode * Fix rendering and added option to skip rendering on plain mode * Remove unnecessary WikiLink as it is automatically added * Remove unused skipPlainRendering prop Co-authored-by: Alasdair Smith GitOrigin-RevId: 7091873beaa05b04f534628cbdd9a559020cfc8e --- .../HumanReadableLogsRules.js | 50 ++++++++++--------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/services/web/frontend/js/ide/human-readable-logs/HumanReadableLogsRules.js b/services/web/frontend/js/ide/human-readable-logs/HumanReadableLogsRules.js index 1680bc6052..c2e0df507d 100644 --- a/services/web/frontend/js/ide/human-readable-logs/HumanReadableLogsRules.js +++ b/services/web/frontend/js/ide/human-readable-logs/HumanReadableLogsRules.js @@ -1,18 +1,20 @@ /* eslint-disable no-useless-escape */ import PropTypes from 'prop-types' -function WikiLink({ url, children }) { - return window.wikiEnabled ? ( - - {children} - - ) : ( - <>{children} - ) +function WikiLink({ url, children, skipPlainRendering }) { + if (window.wikiEnabled) { + return ( + + {children} + + ) + } else { + return <>{children} + } } WikiLink.propTypes = { - url: PropTypes.string, + url: PropTypes.string.isRequired, children: PropTypes.node.isRequired, } @@ -70,23 +72,25 @@ const rules = [ extraInfoURL: 'https://www.overleaf.com/learn/Errors/Missing_$_inserted', humanReadableHintComponent: ( <> - Check that your $'s match around math expressions. If they do, then - you've probably used a symbol in normal text that needs to be in math - mode. Symbols such as subscripts ( _ ), integrals ( \int ), Greek - letters ( \alpha, \beta, \delta ), and modifiers (\vec - {'{x}'}, \tilde - {'{x}'} ) must be written in math mode. See the full list{' '} - - here - - . If you intended to use mathematics mode, then use $ … $ for 'inline - math mode', $$ … $$ for 'display math mode' or alternatively \begin - {'{math}'} … \end - {'{math}'}. +

+ You need to enclose all mathematical expressions and symbols with + special markers. These special markers create a ‘math mode’. +

+

+ Use $...$ for inline math mode, and \[...\] + or one of the mathematical environments (e.g. equation) for display + math mode. +

+

+ This applies to symbols such as subscripts ( _ ), + integrals ( \int ), Greek letters ( \alpha,{' '} + \beta, \delta ) and modifiers{' '} + {'(\\vec{x}'}, {'\\tilde{x}'}). +

), humanReadableHint: - 'Check that your $'s match around math expressions. If they do, then you've probably used a symbol in normal text that needs to be in math mode. Symbols such as subscripts ( _ ), integrals ( \\int ), Greek letters ( \\alpha, \\beta, \\delta ), and modifiers (\\vec{x}, \\tilde{x} ) must be written in math mode. See the full list here. If you intended to use mathematics mode, then use $ … $ for 'inline math mode', $$ … $$ for 'display math mode' or alternatively \\begin{math} … \\end{math}.', + 'You need to enclose all mathematical expressions and symbols with special markers. These special markers create a ‘math mode’. Use $...$ for inline math mode, and \\[...\\] or one of the mathematical environments (e.g. equation) for display math mode. This applies to symbols such as subscripts ( _ ), integrals ( \\int ), Greek letters ( \\alpha, \\beta, \\delta ) and modifiers (\\vec{x}, \\tilde{x} ).', }, { regexToMatch: /(undefined )?[rR]eference(s)?.+(undefined)?/,