From f8068c0db3c1a9443ec9c8f80a827f58f5032d94 Mon Sep 17 00:00:00 2001 From: Michael Naumov Date: Fri, 2 Dec 2022 10:11:44 -0600 Subject: [PATCH] Exclude math and inline math --- __tests__/empty-line-around-tables.test.ts | 26 ++++++++++++++++++++++ src/rules/empty-line-around-tables.ts | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/__tests__/empty-line-around-tables.test.ts b/__tests__/empty-line-around-tables.test.ts index 06eca7da..b3c20bf6 100644 --- a/__tests__/empty-line-around-tables.test.ts +++ b/__tests__/empty-line-around-tables.test.ts @@ -47,5 +47,31 @@ ruleTest({ > | quux | quuz | `, }, + { + testName: 'Don\'t modify inline math', + before: dedent` + ${''} + $|a| + |b|$ + `, + after: dedent` + ${''} + $|a| + |b|$ + `, + }, + { + testName: 'Don\'t modify math', + before: dedent` + ${''} + $$ + |a| + |b| + $$ + `, + after: dedent` + ${''} + $$ + |a| + |b| + $$ + `, + }, ], }); diff --git a/src/rules/empty-line-around-tables.ts b/src/rules/empty-line-around-tables.ts index 01c7d704..e8227cd2 100644 --- a/src/rules/empty-line-around-tables.ts +++ b/src/rules/empty-line-around-tables.ts @@ -22,7 +22,7 @@ export default class EmptyLineAroundTables extends RuleBuilder { + return ignoreListOfTypes([IgnoreTypes.yaml, IgnoreTypes.code, IgnoreTypes.math, IgnoreTypes.inlineMath], text, (text: string) => { return ensureEmptyLinesAroundTables(text); }); }