html tidy and rails apps - erb or rthml files. Ruby alternative? - html

I just installed HTML Tidy plugin for eclipse. I added the html.erb file type and now it will do its magic on my erb files. However it puts in the title tag and changes a lot of my characters to escape characters. How can I stop this from happening - or is there a ruby alternative which will go through my code, reindent, and stick in missing tags? I'm worried about a lot of my erb files since the built in formatter with Aptana is hard to use. I don't see any glaring errors when I view the page, but I'm sure there are some mismatched tags and stuff that I'd like to get rid of. Any recommendations?

I haven't tried it but found Rack::Tidy

Related

HTML syntax not highlighting correctly

The syntax highlighting for .html files does not work.
However, highlighting for .css files does work. Any ideas what should I do?
If anyone might find it important (though none of them affect HTML other than the indentation colors one, and I use the default Microsoft VSCode HTML syntax highlighting), this is the list of my extensions:
I solved the issue. I realised that once when I was meddling with something I added by accident a single character to the beginning of the file Microsoft VS Code\Resources\App\Extensions\html\syntaxes\html.tmLanguage.json which made VSCode unable to parse it. The highlighting works now.

Format html code in flask?

Is it possible to format html code before I render it with flask? In my current project, I use many jinja templates and everything is working, but the source code in the browser, doesn't look so good. It's not so important but it would look much nicer with a prettified html code.
Thanks
Intellij Idea understand .html files with jinja2 templates. Just use CTRL + ALT + L for make formatting of whole file.

Can you beautify jekyll html output at build time

Is there a way to automatically beautify the html output from Jekyll after it builds the site directory?
The easiest way should be using Jekyll::Tidy plugin.
Just add following to your _config.yml:
gems:
- jekyll-tidy
However for me it does not does not produce pretty HTML with correct indentation.
If you are OK depending on Node.js, using pretty npm package produces pretty results and is the only way which worked 100% correct for me. Just wrap it to simple script and run after building your site.
You can also checkout my blog post Pretty HTML with Jekyll where I describe my solution based on pretty npm package more in detail.
Do you want to beautify or minimize/tidy your HTML? If you just want to get smaller HTML, I'd suggest to give octopress minify-html a try, really does its job.
If you want to have nice HTML tidy HTML is fine (linked above)

Why doesn't my default layout get rendered to my github page?

i'm entirely new to github pages and jekyll and yaml and i've run into some problems while creating my very first project. I suspect the problem lies with the _config file but I have no idea what it is. If you take a look at my site mohmanyang.com, you see that the yaml is rendered as text instead of being replaced with code from the "default.html" which can be found in the _layouts folder. Here is the project on github, any help will be appreciated.
I guess that you're developing on Windows and that your editor is saving files with utf-8 with BOM.
Jekyll doesn't like BOM. Saving you files with utf-8 with no BOM will make the magic.

Masterpage concept for plain HTML

I got a realtive big project for what I have many plain HTML pages. All the pages have the same template, but when I change one value in the template I have to change all the other pages manually.
Is there a way to do it like less for CSS or CoffeeScript for JS?
Lg Knerd
If all you have are plain HTML pages you could use SSI although it is a bit dated and youll need to be running this on a web server like Apache.
http://en.wikipedia.org/wiki/Server_Side_Includes
Personally I would use php so I could just include the files with the php include function