Skip to content

Commit

Permalink
fix: formatter for html
Browse files Browse the repository at this point in the history
Fixes error caused by html formatter running even when tidy is not
available on the system. Also fixes docs related to disabling
formatters.
  • Loading branch information
udayvir-singh committed Dec 30, 2022
1 parent e1482ea commit e5e364f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ use {
show_http_info = true,
show_headers = true,
-- executables or functions for formatting response body [optional]
-- set them to nil if you want to disable them
-- set them to false if you want to disable them
formatters = {
json = "jq",
html = function(body)
Expand Down
3 changes: 3 additions & 0 deletions lua/rest-nvim/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ local config = {
formatters = {
json = "jq",
html = function(body)
if vim.fn.executable("tidy") == 0 then
return body
end
-- stylua: ignore
return vim.fn.system({
"tidy", "-i", "-q",
Expand Down

0 comments on commit e5e364f

Please sign in to comment.