Skip to content

Commit

Permalink
dev(docstring): remove indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
cnrpman authored and tiensonqin committed Jun 15, 2023
1 parent 6cbbd66 commit e50e129
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions deps/graph-parser/src/logseq/graph_parser/mldoc.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,16 @@
js/JSON.stringify))))

(defn remove-indentation-spaces
"Remove the indentation spaces from the content. Only for markdown."
[s level remove-first-line?]
(let [lines (string/split-lines s)
[f & r] lines
body (map (fn [line]
;; Check if the indentation area only contains white spaces
(if (string/blank? (gp-util/safe-subs line 0 level))
;; If valid, then remove the indentation area spaces. Keep the rest of the line (might contain leading spaces)
(gp-util/safe-subs line level)
;; Otherwise, trim these invalid spaces
(string/triml line)))
(if remove-first-line? lines r))
content (if remove-first-line? body (cons f body))]
Expand Down

0 comments on commit e50e129

Please sign in to comment.