src/worker.js
function replaceCodeBlocks(contents) {
	function processCode() {
		return ast => {
			visit(ast, 'code', node => {
				const start = node.position.start.line;
				const end = node.position.end.line;
				for (let line = start; line < end - 1; line++) {
					lines[line] = '';
				}
			});
		};
	}

	const lines = splitLines(contents);
	remark()
		.use(processCode)
		.process(contents)
	;
	return lines.join('\n');
}
function replaceCodeBlocks(contents) {
	function processCode() {
		return ast => {
			visit(ast, 'code', node => {
				const start = node.position.start.line;
				const end = node.position.end.line;
				for (let line = start; line < end - 1; line++) {
					lines[line] = '';
				}
			});
		};
	}

	const lines = splitLines(contents);
	remark()
		.use(processCode)
		.process(contents)
	;
	return lines.join('\n');
}
function replaceCodeBlocks ( contents ) { function processCode ( ) { return ast => { visit ( ast , 'code' , node => { const start = node . position . start . line ; const end = node . position . end . line ; for ( let line = start ; line < end - 1 ; line ++ ) { lines [ line ] = '' ; } } ) ; } ; } const lines = splitLines ( contents ) ; remark ( ) . use ( processCode ) . process ( contents ) ; return lines . join ( '\n' ) ; }
Replace all lines inside code blocks with empty lines becase proselint validates code by default. We use empty lines instead of just code removal to keep correct line numbers. Work with the original document because Remark changes formatting which makes error positions incorrect
Replace all lines inside code blocks with empty lines becase proselint validates code by default . We use empty lines instead of just code removal to keep correct line numbers . Work with the original document because Remark changes formatting which makes error positions incorrect