summaryrefslogtreecommitdiff
path: root/src/clarktown/matchers/heading_block.clj
diff options
context:
space:
mode:
authorAsko Nõmm <84135165+askonomm@users.noreply.github.com>2022-04-30 12:12:28 +0300
committerGitHub <noreply@github.com>2022-04-30 12:12:28 +0300
commitfaf11bf88b598d55f81899784c7c16e32a8d415d (patch)
tree287468b35b2815a7164225883669e070bde39b63 /src/clarktown/matchers/heading_block.clj
parentd6e39c016e16b60b85b60898e93eda8d2c6f00db (diff)
parentee7ab7fd1163a1a8444e16017793eb32a0eb08ee (diff)
Merge pull request #25 from askonomm/issue-22
Improve ATX heading blocks
Diffstat (limited to 'src/clarktown/matchers/heading_block.clj')
-rw-r--r--src/clarktown/matchers/heading_block.clj6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/clarktown/matchers/heading_block.clj b/src/clarktown/matchers/heading_block.clj
index 2295f26..1a9a451 100644
--- a/src/clarktown/matchers/heading_block.clj
+++ b/src/clarktown/matchers/heading_block.clj
@@ -6,9 +6,7 @@
(defn is-atx-heading?
"Determines whether the given block is a atx heading."
[block]
- (-> (string/replace block #"\n" "")
- string/trim
- (string/starts-with? "#")))
+ (re-matches #"^\#{1,6}\s.*" block))
(defn is-settext-heading?
@@ -26,4 +24,4 @@
"Determines whether the given block is a heading block."
[block]
(or (is-atx-heading? block)
- (is-settext-heading? block))) \ No newline at end of file
+ (is-settext-heading? block)))