Closed jessebett closed 6 years ago
http://api.html-tidy.org/tidy/tidylib_api_5.2.0/tidy_config.html You probably need to configure tidy
to indent files how you want instead.
@jessebett you could set a .tidyrc
file as given in the above link. The sample rc file given there should work for you.
indent: auto
indent-spaces: 2
wrap: 72
markup: yes
output-xml: no
input-xml: no
show-warnings: yes
numeric-entities: yes
quote-marks: yes
quote-nbsp: yes
quote-ampersand: no
break-before-br: no
uppercase-tags: no
uppercase-attributes: no
char-encoding: latin1
new-inline-tags: cfif, cfelse, math, mroot,
mrow, mi, mn, mo, msqrt, mfrac, msubsup, munderover,
munder, mover, mmultiscripts, msup, msub, mtext,
mprescripts, mtable, mtr, mtd, mth
new-blocklevel-tags: cfoutput, cfquery
new-empty-tags: cfelse
Also, once https://github.com/w0rp/ale/pull/2060 is merged you could make use of prettier
to do html formatting which will be much better.
Thanks @meain I'll wait for the prettier merge. @w0rp you are right I did not configure any indentation stuff for tidy. Thanks!
Information
VIM version
NVIM v0.2.0 Build type: Release
Operating System: OSX 10.13.1
What went wrong
Calling
:ALEFix
on an html file withtidy
fixer removes most of the indenting. I only noticed this behaviour on a some html files:Reproducing the bug
:ALEFix
For example, the default reveal.js index.html file:
Before:
After
:ALEFix
:ALEInfo
Current Filetype: html Available Linters: ['alex', 'htmlhint', 'proselint', 'stylelint', 'tidy', 'writegood'] Linter Aliases: 'writegood' -> ['write-good'] Enabled Linters: ['alex', 'htmlhint', 'proselint', 'stylelint', 'tidy', 'writegood'] Suggested Fixers: 'remove_trailing_lines' - Remove all blank lines at the end of a file. 'tidy' - Fix HTML files with tidy. 'trim_whitespace' - Remove all trailing whitespace characters at the end of every line. Linter Variables:
let g:ale_html_htmlhint_executable = 'htmlhint' let g:ale_html_htmlhint_options = '' let g:ale_html_htmlhint_use_global = 0 let g:ale_html_stylelint_executable = 'stylelint' let g:ale_html_stylelint_options = '' let g:ale_html_stylelint_use_global = 0 let g:ale_html_tidy_executable = 'tidy' let g:ale_html_tidy_options = '-q -e -language en' let g:ale_html_tidy_use_global = 0 Global Variables:
let g:ale_cache_executable_check_failures = v:null let g:ale_change_sign_column_color = 0 let g:ale_command_wrapper = '' let g:ale_completion_delay = v:null let g:ale_completion_enabled = 0 let g:ale_completion_max_suggestions = v:null let g:ale_echo_cursor = 1 let g:ale_echo_msg_error_str = 'Error' let g:ale_echo_msg_format = '%code: %%s' let g:ale_echo_msg_info_str = 'Info' let g:ale_echo_msg_warning_str = 'Warning' let g:ale_enabled = 1 let g:ale_fix_on_save = 0 let g:ale_fixers = {'markdown': ['prettier'], 'json': ['prettier', 'eslint'], 'html': ['tidy'], '*': ['remove_trailing_lines', 'trim_whitespace']} let g:ale_history_enabled = 1 let g:ale_history_log_output = 1 let g:ale_keep_list_window_open = 0 let g:ale_lint_delay = 200 let g:ale_lint_on_enter = 1 let g:ale_lint_on_filetype_changed = 1 let g:ale_lint_on_save = 1 let g:ale_lint_on_text_changed = 'always' let g:ale_lint_on_insert_leave = 0 let g:ale_linter_aliases = {} let g:ale_linters = {} let g:ale_linters_explicit = 0 let g:ale_list_window_size = 10 let g:ale_list_vertical = 0 let g:ale_loclist_msg_format = '%code: %%s' let g:ale_max_buffer_history_size = 20 let g:ale_max_signs = -1 let g:ale_maximum_file_size = v:null let g:ale_open_list = 0 let g:ale_pattern_options = v:null let g:ale_pattern_options_enabled = v:null let g:ale_set_balloons = 0 let g:ale_set_highlights = 1 let g:ale_set_loclist = 1 let g:ale_set_quickfix = 0 let g:ale_set_signs = 1 let g:ale_sign_column_always = 0 let g:ale_sign_error = '>>' let g:ale_sign_info = '--' let g:ale_sign_offset = 1000000 let g:ale_sign_style_error = '>>' let g:ale_sign_style_warning = '--' let g:ale_sign_warning = '--' let g:ale_statusline_format = v:null let g:ale_type_map = {} let g:ale_use_global_executables = v:null let g:ale_warn_about_trailing_blank_lines = 1 let g:ale_warn_about_trailing_whitespace = 1 Command History:
(executable check - failure) proselint (executable check - failure) stylelint (finished - exit code 0) ['/bin/zsh', '-c', 'tidy -q -e -language en -utf8 - < ''/var/folders/jw/ltyk9x9n0_xb61jhdnct27fr0000gn/T/nvimAYnSVy/31/index.html''']
<<>>
(executable check - failure) write-good (executable check - failure) htmlhint (executable check - failure) proselint (executable check - failure) stylelint (finished - exit code 0) ['/bin/zsh', '-c', 'tidy -q -e -language en -utf8 - < ''/var/folders/jw/ltyk9x9n0_xb61jhdnct27fr0000gn/T/nvimAYnSVy/32/index.html''']
<<>>
(executable check - failure) write-good (finished - exit code 0) ['/bin/zsh', '-c', '''tidy'' -q --tidy-mark no --show-errors 0 --show-warnings 0 < ''/var/folders/jw/ltyk9x9n0_xb61jhdnct27fr0000gn/T/nvimAYnSVy/33/index.html'''] (executable check - failure) htmlhint (executable check - failure) proselint (executable check - failure) stylelint (finished - exit code 0) ['/bin/zsh', '-c', 'tidy -q -e -language en -utf8 - < ''/var/folders/jw/ltyk9x9n0_xb61jhdnct27fr0000gn/T/nvimAYnSVy/34/index.html''']
<<>>
(executable check - failure) write-good (executable check - failure) htmlhint (executable check - failure) proselint (executable check - failure) stylelint (finished - exit code 0) ['/bin/zsh', '-c', 'tidy -q -e -language en -utf8 - < ''/var/folders/jw/ltyk9x9n0_xb61jhdnct27fr0000gn/T/nvimAYnSVy/35/index.html''']
<<>>
(executable check - failure) write-good