mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
e025088065
Add documentation for CodeMirror extensions GitOrigin-RevId: e5f07084173f201919272f9d46dcdaef4b817874
18 lines
685 B
TypeScript
18 lines
685 B
TypeScript
import { sourceOnly } from './visual/visual'
|
|
import { highlightSpecialChars as _highlightSpecialChars } from '@codemirror/view'
|
|
|
|
/**
|
|
* The built-in extension which highlights unusual whitespace characters,
|
|
* configured to highlight additional space characters.
|
|
*/
|
|
export const highlightSpecialChars = (visual: boolean) =>
|
|
sourceOnly(
|
|
visual,
|
|
_highlightSpecialChars({
|
|
addSpecialChars: new RegExp(
|
|
// non standard space characters (https://jkorpela.fi/chars/spaces.html)
|
|
'[\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u200B\u202F\u205F\u3000\uFEFF]',
|
|
/x/.unicode != null ? 'gu' : 'g'
|
|
),
|
|
})
|
|
)
|