mirror of
https://github.com/outline/outline.git
synced 2026-12-01 09:22:14 +03:00
fix: Table detection in isMarkdown, closes #6687
This commit is contained in:
1 parent
6d81be2f13
commit
be211dbc5c
2 files changed
+12
-1
No files matched your search
@@ -49,6 +49,17 @@ test("returns true for heading", () => {
|
||||
expect(isMarkdown(`### Heading 3`)).toBe(true);
|
||||
});
|
||||
|
||||
test("returns false for table", () => {
|
||||
expect(
|
||||
isMarkdown(`
|
||||
|NAME|TYPE|CLUSTER-IP|EXTERNAL-IP|PORT(S)|AGE|
|
||||
|-|-|-|-|-|-|
|
||||
|rancher-webhook|ClusterIP|10.43.198.97|<none>|443/TCP|258d|
|
||||
|rancher|ClusterIP|10.43.50.214|<none>|80/TCP,443/TCP|258d|
|
||||
`)
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
test("returns false for hashtag", () => {
|
||||
expect(isMarkdown(`Test #hashtag`)).toBe(false);
|
||||
expect(isMarkdown(` #hashtag`)).toBe(false);
|
||||
|
||||
@@ -25,7 +25,7 @@ export default function isMarkdown(text: string): boolean {
|
||||
}
|
||||
|
||||
// table header-ish
|
||||
const tables = text.match(/^\|\s?[-]+\s?\|/gm);
|
||||
const tables = text.match(/\|\s?[-]+\s?\|/gm);
|
||||
if (tables && tables.length > 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user