mirror of https://github.com/logseq/logseq
Add allowed tags
parent
e147c88f08
commit
1363ca13f7
|
@ -20,6 +20,20 @@
|
|||
|
||||
(str (hiccup-without-style hiccup))))
|
||||
|
||||
(def allowed-tags
|
||||
#{:address, :article, :aside, :footer, :header,
|
||||
:h1, :h2, :h3, :h4, :h5, :h6, :hgroup,
|
||||
:main, :nav, :section,
|
||||
:blockquote, :dd, :div, :dl, :dt, :figcaption, :figure,
|
||||
:hr, :li, :ol, :p, :pre, :ul,
|
||||
:a, :abbr, :b, :bdi, :bdo, :br, :cite, :code, :data, :dfn,
|
||||
:em, :i, :kbd, :mark, :q,
|
||||
:rb, :rp, :rt, :rtc, :ruby,
|
||||
:s, :samp, :small, :span, :strong, :sub, :sup, :time, :u, :var, :wbr,
|
||||
:caption, :col, :colgroup, :table, :tbody, :td, :tfoot, :th,
|
||||
:thead, :tr
|
||||
:body :html})
|
||||
|
||||
(defn ^:large-vars/cleanup-todo hiccup->doc-inner
|
||||
[format hiccup opts]
|
||||
(let [transform-fn (fn [hiccup opts]
|
||||
|
@ -77,7 +91,10 @@
|
|||
(if (string? pattern) pattern (apply str (reverse pattern)))))))
|
||||
wrapper (fn [tag content]
|
||||
(let [content (cond
|
||||
(contains? #{:comment :head :w :style :xml :o:p} tag)
|
||||
(not (contains? allowed-tags tag))
|
||||
nil
|
||||
|
||||
(contains? #{:comment :head :style :xml} tag)
|
||||
nil
|
||||
|
||||
(and (= tag :p) (:in-table? opts))
|
||||
|
@ -239,7 +256,6 @@
|
|||
(when-not (string/blank? html)
|
||||
(let [hiccup (hickory/as-hiccup (hickory/parse html))
|
||||
decoded-hiccup (html-decode-hiccup hiccup)]
|
||||
(def hiccup hiccup)
|
||||
(hiccup->doc format decoded-hiccup))))
|
||||
|
||||
(comment
|
||||
|
|
Loading…
Reference in New Issue