Skip to content

Instantly share code, notes, and snippets.

@loicginoux
Last active November 12, 2024 20:11
Show Gist options
  • Save loicginoux/70c100cfd5426b88a457af29555b69b4 to your computer and use it in GitHub Desktop.
Save loicginoux/70c100cfd5426b88a457af29555b69b4 to your computer and use it in GitHub Desktop.
Display indented html string in ruby irb console
html_string = "<table class=\"table table-bordered\"><tr><td>Frais TTC</td><td>10.00 €</td></tr><tr><td>Remise TTC</td><td>-1.00 €</td></tr><tr><td><i>Montant HT</i></td><td>7.50 €</td></tr><tr><td><i>TVA (20%)</i></td><td>1.50 €</td></tr><tr><td><b>Total TTC</b></td><td><b>9.00 €</b></td></tr></table>"
pp Nokogiri::HTML(html_string).to_xhtml(indent: 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment