Liking cljdoc? Tell your friends :D

io.github.papachan.montalivet

A Clojure library for parsing, sanitising and escaping HTML, built on jsoup.

A Clojure library for parsing, sanitising and escaping HTML, built on jsoup.
raw docstring

body-htmlclj

(body-html doc)

Returns the inner HTML of the document body as a string.

Returns the inner HTML of the document body as a string.
sourceraw docstring

cleanclj

(clean html)
(clean html opts)

Removes everything from the html string that is not allowed by a safelist, so that untrusted markup can be embedded safely. Returns a string.

Options:

  • :safelist one of :none, :simple-text, :basic (default), :basic-with-images, :relaxed.
  • :add-tags tags to allow in addition to the safelist, e.g. [:section].
  • :remove-tags tags to disallow.
  • :add-attributes map of tag to attributes to allow, e.g. {:a [:target] :all [:class]}.
  • :remove-attributes same shape, to disallow attributes.
  • :base-uri base used to resolve relative links, default "". Without it, relative links cannot be resolved and are removed.
  • :preserve-relative-links keep relative URLs as they are instead of making them absolute. Still requires :base-uri.
  • :pretty-print boolean, default false.
  • :escape-mode one of :base, :xhtml, :extended.
Removes everything from the `html` string that is not allowed by a
safelist, so that untrusted markup can be embedded safely. Returns a
string.

Options:
- `:safelist`  one of :none, :simple-text, :basic (default),
               :basic-with-images, :relaxed.
- `:add-tags`  tags to allow in addition to the safelist, e.g. [:section].
- `:remove-tags` tags to disallow.
- `:add-attributes` map of tag to attributes to allow,
               e.g. {:a [:target] :all [:class]}.
- `:remove-attributes` same shape, to disallow attributes.
- `:base-uri`  base used to resolve relative links, default "". Without
               it, relative links cannot be resolved and are removed.
- `:preserve-relative-links` keep relative URLs as they are instead of
               making them absolute. Still requires `:base-uri`.
- `:pretty-print` boolean, default false.
- `:escape-mode` one of :base, :xhtml, :extended.
sourceraw docstring

escape-htmlclj

(escape-html s)
(escape-html s opts)

Escapes s so it is safe to embed as HTML text.

Takes the same :escape-mode and :pretty-print options as parse (default :base).

Escapes `s` so it is safe to embed as HTML text.

Takes the same `:escape-mode` and `:pretty-print` options as `parse`
(default :base).
sourceraw docstring

parseclj

(parse html)
(parse html opts)

Parses the html string into a jsoup Document.

Options:

  • :pretty-print boolean, default true.
  • :escape-mode one of :base, :xhtml, :extended.
Parses the `html` string into a jsoup Document.

Options:
- `:pretty-print` boolean, default true.
- `:escape-mode`  one of :base, :xhtml, :extended.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close