function adjustBlock(block) {
	const leadingCommentLines = block.comments.reduce(
		(count, comment) => count + comment.split("\n").length,
		0,
	);

	const blockStart = block.position.start.line;

	/**
	 * Adjusts ESLint messages to point to the correct location in the Markdown.
	 * @param {Message} message A message from ESLint.
	 * @returns {Message} The same message, but adjusted to the correct location.
	 */
	return function adjustMessage(message) {
		if (!Number.isInteger(message.line)) {
			return {
				...message,
				line: blockStart,
				column: block.position.start.column,
			};
		}

		const lineInCode = message.line - leadingCommentLines;

		if (lineInCode < 1 || lineInCode >= block.rangeMap.length) {
			return null;
		}

		const out = {
			line: lineInCode + blockStart,
			column: message.column + block.rangeMap[lineInCode].indent,
		};

		if (Number.isInteger(message.endLine)) {
			out.endLine = message.endLine - leadingCommentLines + blockStart;
		}

		if (Array.isArray(message.suggestions)) {
			out.suggestions = message.suggestions.map(suggestion => ({
				...suggestion,
				fix: adjustFix(block, suggestion.fix),
			}));
		}

		const adjustedFix = {};

		if (message.fix) {
			adjustedFix.fix = adjustFix(block, message.fix);
		}

		return { ...message, ...out, ...adjustedFix };
	};
}
Creates a map function that adjusts messages in a code block.
@param {Block} block A code block.
@returns {(message: Message) => Message} A function that adjusts messages in a code block.