mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
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 <ali@alasdairsmith.co.uk> GitOrigin-RevId: 7091873beaa05b04f534628cbdd9a559020cfc8e
This commit is contained in:
parent
ebc80fed8a
commit
296ce0e460
1 changed files with 27 additions and 23 deletions
|
@ -1,18 +1,20 @@
|
||||||
/* eslint-disable no-useless-escape */
|
/* eslint-disable no-useless-escape */
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
function WikiLink({ url, children }) {
|
function WikiLink({ url, children, skipPlainRendering }) {
|
||||||
return window.wikiEnabled ? (
|
if (window.wikiEnabled) {
|
||||||
|
return (
|
||||||
<a href={url} target="_blank">
|
<a href={url} target="_blank">
|
||||||
{children}
|
{children}
|
||||||
</a>
|
</a>
|
||||||
) : (
|
|
||||||
<>{children}</>
|
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
return <>{children}</>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WikiLink.propTypes = {
|
WikiLink.propTypes = {
|
||||||
url: PropTypes.string,
|
url: PropTypes.string.isRequired,
|
||||||
children: PropTypes.node.isRequired,
|
children: PropTypes.node.isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,23 +72,25 @@ const rules = [
|
||||||
extraInfoURL: 'https://www.overleaf.com/learn/Errors/Missing_$_inserted',
|
extraInfoURL: 'https://www.overleaf.com/learn/Errors/Missing_$_inserted',
|
||||||
humanReadableHintComponent: (
|
humanReadableHintComponent: (
|
||||||
<>
|
<>
|
||||||
Check that your $'s match around math expressions. If they do, then
|
<p>
|
||||||
you've probably used a symbol in normal text that needs to be in math
|
You need to enclose all mathematical expressions and symbols with
|
||||||
mode. Symbols such as subscripts ( _ ), integrals ( \int ), Greek
|
special markers. These special markers create a ‘math mode’.
|
||||||
letters ( \alpha, \beta, \delta ), and modifiers (\vec
|
</p>
|
||||||
{'{x}'}, \tilde
|
<p>
|
||||||
{'{x}'} ) must be written in math mode. See the full list{' '}
|
Use <code>$...$</code> for inline math mode, and <code>\[...\]</code>
|
||||||
<WikiLink url="https://www.overleaf.com/learn/Errors/Missing_$_inserted">
|
or one of the mathematical environments (e.g. equation) for display
|
||||||
here
|
math mode.
|
||||||
</WikiLink>
|
</p>
|
||||||
. If you intended to use mathematics mode, then use $ … $ for 'inline
|
<p>
|
||||||
math mode', $$ … $$ for 'display math mode' or alternatively \begin
|
This applies to symbols such as subscripts ( <code>_</code> ),
|
||||||
{'{math}'} … \end
|
integrals ( <code>\int</code> ), Greek letters ( <code>\alpha</code>,{' '}
|
||||||
{'{math}'}.
|
<code>\beta</code>, <code>\delta</code> ) and modifiers{' '}
|
||||||
|
<code>{'(\\vec{x}'}</code>, <code>{'\\tilde{x}'})</code>.
|
||||||
|
</p>
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
humanReadableHint:
|
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 <a href="https://www.overleaf.com/learn/Errors/Missing_$_inserted" target="_blank">here</a>. 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)?/,
|
regexToMatch: /(undefined )?[rR]eference(s)?.+(undefined)?/,
|
||||||
|
|
Loading…
Reference in a new issue