Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(add) Option to format readable HTML #134

Open
igalic opened this issue May 5, 2020 · 6 comments
Open

(add) Option to format readable HTML #134

igalic opened this issue May 5, 2020 · 6 comments

Comments

@igalic
Copy link
Contributor

igalic commented May 5, 2020

I like to have produce readable HTML on my site.

Is there an option i can pass to Serum / Earmark to do that?

@Dalgona
Copy link
Owner

Dalgona commented May 5, 2020

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. 🤣

@Dalgona
Copy link
Owner

Dalgona commented May 6, 2020

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.

@igalic
Copy link
Contributor Author

igalic commented Mar 28, 2021

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.

@igalic igalic closed this as completed Mar 28, 2021
@Dalgona
Copy link
Owner

Dalgona commented Mar 28, 2021

Thank you for the update! And I'm also sorry for not being able to actively develop/maintain this project for the moment. 🙏

@igalic
Copy link
Contributor Author

igalic commented Mar 29, 2021

no worries, it works well enough without active development!

@Dalgona
Copy link
Owner

Dalgona commented Apr 3, 2021

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.

@Dalgona Dalgona reopened this Apr 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants