Use js-beautify for formatting HTML #1089
Closed
nitrohorse wants to merge 21 commits from
add-beautify
into master
pull from: add-beautify
merge into: privacyguides:master
privacyguides:master
privacyguides:dependabot/bundler/nokogiri-1.13.6
privacyguides:dependabot/bundler/addressable-2.8.0
privacyguides:freddy-m-patch-3
privacyguides:pr-add_RemoveMyPhone_sponsor
privacyguides:pr-browser_cleanup_1257_1328_1430
privacyguides:freddy-m-patch-2
privacyguides:freddy-m-patch-1
privacyguides:pr-vpn_hated_one_video
privacyguides:cdn
privacyguides:update-nitrohorse-image
privacyguides:promote-metager-to-card
privacyguides:hardware
privacyguides:pr-add_azirevpn
privacyguides:pr-add_mailfence
privacyguides:shop
privacyguides:1673
privacyguides:pr/1658
privacyguides:i18n-simple
privacyguides:sponsorship-edits-nov2019
privacyguides:i18n
privacyguides:ipfs
privacyguides:blacklight447-ptio-patch-3
privacyguides:blog
privacyguides:remove-windows-icons
privacyguides:pr/1147
privacyguides:i18n-testing
Labels
Clear labels
🔍🤖 Search Engines
approved
approved, waiting for a PR
dependencies
Pull requests that update a dependency file
duplicate
feedback wanted
high priority
I2P
The Invisible Internet Project (I2P)
iOS
low priority
OS
Operating Systems
Self-contained networks
Social media
stale
A label for stalebot if it gets added
streaming
Anything related to media streaming.
todo
Tor
Anything covering the Tor network
WIP
active work in progress, do not merge or PR (yet)!
wontfix
Issues or bugs that will not be fixed and/or do not have significant impact on the project.
XMPP
Extensible Messaging and Presence Protocol
[m]
Matrix protocol
₿ cryptocurrency
ℹ️ help wanted
↔️ file sharing
⚙️ web extensions
Browser Extension related issues
✨ enhancement
❌ software removal
💬 discussion
🤖 Android
🐛 bug
💢 conflicting
📝 correction
Correction of content on the website
🆘 critical
📧 email
🔒 file encryption
📁 file storage
🦊 Firefox
Firefox & forks, about:config etc.
💻 hardware
🌐 hosting
🏠 housekeeping
Anything primarily related to site cleanup.
🔐 password managers
🧰 productivity tools
🔎 research required
🌐 Social News Aggregators
🆕 software suggestion
👥 team chat
🔒 VPN
Virtual Private Network
🌐 website issue
*Technical* issues with the website.
🚫 Windows
👁️ browsers
🖊️ digital notebooks
🗄️ DNS
Domain Name System
🗨️ instant messaging (im)
🇦🇶 translations
Anything covering a translated version of the site
No Label
🏠 housekeeping
Milestone
No items
No Milestone
No due date set.
Dependencies
No dependencies set.
Reference: privacyguides/privacytools.io#1089
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
No description provided.
Delete Branch "add-beautify"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Related: https://github.com/privacytoolsIO/privacytools.io/pull/900
This PR introduces "js-beautify" for auto-formatting the HTML code on code commits and git pushes based on specified rules in
.jsbeautifyrc
(here's a larger example). The rule I added for now includes using tabs over spaces. Overall, this tooling will increase style consistency and maintainability for contributors 😄Example of trying to commit unformatted code:
Example of committing unformatted code and Travis failing the build:
Alternatively, @dawidpotocki mentioned Prettier which could also do this job. I also have a working, local branch for that but felt Beautify to be more tailored and simpler for our needs at the moment. I also ran into some weird HTML formatting issues (such as https://github.com/prettier/prettier-vscode/issues/646) when using Prettier.
Deploy preview for privacytools-io ready!
Built with commit
c9f9cf255b
https://deploy-preview-1089--privacytools-io.netlify.com
Deploy preview for privacytools-io ready!
Built with commit
c7937a241a
https://deploy-preview-1089--privacytools-io.netlify.com
Okay
Still okay
@@ -2,3 +2,3 @@
<div class="alert alert-success" role="alert">
<strong>All providers listed here are operating outside the US and support <a data-toggle="tooltip" data-placement="bottom" data-original-title="When sending or receiving emails, if both the sending and receiving servers support TLS encryption, the email is sent between servers using an encrypted connection.">SMTP TLS.</a> The table is sortable.</strong>
<strong>All providers listed here are operating outside the US and support <a data-toggle="tooltip" data-placement="bottom" data-original-title="When sending or receiving emails, if both the sending and receiving servers support TLS encryption, the email is sent between servers using an encrypted connection.">SMTP TLS.</a> The table is sortable.</strong>
This doesn't seem right
@@ -2,3 +2,3 @@
<div class="alert alert-success" role="alert">
<strong>All providers listed here are operating outside the US and support <a data-toggle="tooltip" data-placement="bottom" data-original-title="When sending or receiving emails, if both the sending and receiving servers support TLS encryption, the email is sent between servers using an encrypted connection.">SMTP TLS.</a> The table is sortable.</strong>
<strong>All providers listed here are operating outside the US and support <a data-toggle="tooltip" data-placement="bottom" data-original-title="When sending or receiving emails, if both the sending and receiving servers support TLS encryption, the email is sent between servers using an encrypted connection.">SMTP TLS.</a> The table is sortable.</strong>
Good catch! Fixed.
What... hmm
Okay, fixed.
This looks scarily big to me, but there are conflicting files so I won't read deeper right now.
Yeah, I'm unsure what direction we want to take with this at the moment. It should be fairly straightforward to get auto-formatting tooling integrated, but for the proposed solutions (Prettier and JS-Beautify) both will introduce NodeJS to the project which will add some complexity and increase maintainability a bit (making sure packages are up-to-date)...
Going to close this until the right formatter tool is decided 👍