How to use the react-diff-view/tokenize.markWord function in react-diff-view

To help you get started, we’ve selected a few react-diff-view examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github otakustay / react-diff-view / site / components / DiffView / Tokenize.worker.js View on Github external
({data: {id, payload}}) => {
        const {hunks, oldSource, language, editsType} = payload;

        const enhancers = [
            editsType === 'none' ? null : markEdits(hunks, {type: editsType}),
            markWord('\r', 'carriage-return', '␍'),
            markWord('\t', 'tab', '→'),
        ];

        const options = {
            highlight: language !== 'text',
            refractor: refractor,
            language: language,
            oldSource: oldSource,
            enhancers: compact(enhancers),
        };

        try {
            const tokens = tokenize(hunks, options);
            const payload = {
                success: true,
                tokens: tokens,
            };
github otakustay / react-diff-view / site / components / DiffView / Tokenize.worker.js View on Github external
({data: {id, payload}}) => {
        const {hunks, oldSource, language, editsType} = payload;

        const enhancers = [
            editsType === 'none' ? null : markEdits(hunks, {type: editsType}),
            markWord('\r', 'carriage-return', '␍'),
            markWord('\t', 'tab', '→'),
        ];

        const options = {
            highlight: language !== 'text',
            refractor: refractor,
            language: language,
            oldSource: oldSource,
            enhancers: compact(enhancers),
        };

        try {
            const tokens = tokenize(hunks, options);
            const payload = {
                success: true,
                tokens: tokens,