Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Tidy2 for Notepad++

Tags:

notepad++

tidy

Something realy strange happend when i try use Tidy2 on my html pages. HTML Entities change from this   to this xA0 (screenshot)

I try different settings in config file but nothing help. Please, some advise

like image 572
Zhivago Avatar asked Feb 14 '13 00:02

Zhivago


People also ask

How can I beautify the code in Notepad ++?

The primary step is to install the XML tools using the Plugin Manager. Then navigate to Menu -> Plugins -> XML Tools -> Pretty Print. You can use the shortcut Ctrl + Alt + Shift + B. For the other older versions, you need to navigate to Menu -> text FX -> HTML Tidy -> Tidy: Reindent XML.

How do I Preview HTML in Notepad ++?

When you make a change and save the HTML file, you can hit refresh on that preview window. Alternately, you can just use Notepad++'s built-in View > View Current File in … submenu, and choose to load your HTML file in Chrome, Edge, Firefox, or (shudder) IE.


3 Answers

You need to set the preserve-entities to 1

http://tidy.sourceforge.net/docs/quickref.html#preserve-entities

just add to the end of the config file

preserve-entities: 1

to open the config file go to: Plugins > Tidy2 > Edit config n

source: https://stackoverflow.com/a/6669947/2455951

like image 113
Ricardo Zorio Avatar answered Sep 19 '22 17:09

Ricardo Zorio


  1. If you use Tidy2, go to: Plugins->Tidy2->Show Config Help

There you will find how to do a configuration. Each key word has its corresponding reasons.

I just try to change the default config to achieve my purpose. I wanted to avoid thisgs as '&#39' when my code was '''. (probably your problem)

At the end the problem was to set.

 quote-marks: no

The reason I found in the file 'Show Config Help' is:

This option specifies if Tidy should output " characters as " as is preferred by some editing environments. The apostrophe character ' is written out as ' since many web browsers don't yet support '.

  1. I'm working with HTML5 and using an encoding in latin1:

2.1 I use Plugins->Tidy2->Edit config1

2.2 I applied it with Plugins->Tidy2->tidy (config 2)

Mi config file is this:

indent: auto
indent-spaces: 2
wrap: 132
markup: yes
output-html: yes
numeric-entities: yes
quote-marks: no
quote-nbsp: yes
quote-ampersand: no
break-before-br: no
uppercase-tags: no
uppercase-attributes: no
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
char-encoding: latin1
output-encoding: no
input-encoding: no
like image 24
kiquenet85 Avatar answered Sep 22 '22 17:09

kiquenet85


I encoutered the same problem. After search and experiment, I found that UTF-8 encoding and these settings don't change '&ampnbsp; (the definitive setting is numeric-entities: no):

indent: auto  
indent-spaces: 2  
wrap: 132  
markup: yes  
output-html: yes  
numeric-entities: no  
quote-marks: no  
quote-nbsp: yes  
quote-ampersand: no   
break-before-br: no  
uppercase-tags: no  
uppercase-attributes: no  
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
like image 31
Mitch Avatar answered Sep 22 '22 17:09

Mitch