Open igalic opened 4 years ago
As far as I know, there's no such option in Earmark. Even Floki, which is a HTML parser used internally by Serum, does not have one.
Still, I would like to have this feature in Serum one day, by implementing HTML pretty formatter on my own (if necessary 😅).
EDIT: I forgot to mention that there's currently no HTML pretty formatter package on Hex either... That's why I said I'd implement it on my own if necessary. 🤣
In the meantime, I'm sad to say this, you might want to temporarily rely on an external program and optionally a shell script for automation.
here's my Makefile
to build my websites:
tidy!=(which tidy5 || which tidy)
update-static:
rm -rf site/
env TZ=UTC MIX_ENV=prod mix serum.build
$(tidy) -config tidy.config site/*.html || true
$(tidy) -config tidy.config site/thoughts/*.html || true
with the following tidy.config:
indent: auto
indent-spaces: 4
tidy-mark: no
punctuation-wrap: yes
vertical-space: yes
wrap: 111
quiet: yes
write-back: yes
i'm happy with this solution, and will close this issue for now.
Thank you for the update! And I'm also sorry for not being able to actively develop/maintain this project for the moment. 🙏
no worries, it works well enough without active development!
Just noticed that Floki v0.30.0 introduced a new option called :pretty
in Floki.raw_html/2
. It does not provide fine-grained configuration options (just "pretty or not"), but I'll look into it.
I like to have produce readable HTML on my site.
Is there an option i can pass to Serum / Earmark to do that?