sublimetext-codeformatter
sublimetext-codeformatter copied to clipboard
Extra closing tag for <meta ... and <link ....
Using Sublime 3 - after i run the code formatter - got extra html closing tag in head for <meta.. and <link What should i do to not insert in code?
In inserted code you will see
Thanks!
<head> <meta charset="utf-8"> <meta content="IE=edge" http-equiv="X-UA-Compatible"> <meta content="width=device-width, initial-scale=1" name="viewport"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <title> Bootstrap 101 Template </title> <link href="https://fonts.googleapis.com/css?family=Cabin|Source+Sans+Pro:300,400,600,700" rel="stylesheet"> <!-- Bootstrap --> <link href="css/bootstrap.css" rel="stylesheet"> <link href="css/main.css" rel="stylesheet"> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </link> </link> </link> </meta> </meta> </meta> </head>
+1
+1
+1
+1
set "formatter_version": "regexp" in "codeformatter_html_options in PackageSettings
ensure that your HTML code is correctly formatted and does not contain unnecessary closing tags.
Here's the corrected version of your HTML code with the redundant closing tags removed:
<head>
<meta charset="utf-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=device-width, initial-scale=1" name="viewport">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Bootstrap 101 Template</title>
<link href="https://fonts.googleapis.com/css?family=Cabin|Source+Sans+Pro:300,400,600,700" rel="stylesheet">
<!-- Bootstrap -->
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
Make sure your HTML code follows this structure without redundant closing tags, and Sublime Text 3 should format it correctly without adding extra closing tags.
For more meaningful insights do check out Full Stack Web Development Courses