Format html code in flask? - html

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.

Related

IntelliJ change language mode same as VS Code

I'm working on a project(IntelliJ + Grav) which all base files are *.md, I have the need to just write HTML code in one of this MD files but I can find an option to change the syntax highlight or intellisense to trigger(emmet, tags, ...).
In VS Code you can change the language mode no matter which file extension you have open.
Q: Is there a way to make IntelliJ highlight HTML code in a MD file.
PS: Don't tell me to change the file extension or open the file in VS Code, as I'm currently doing it.
You can add the file name to the HTML file type list of files/extensions and IntelliJ IDEA will treat it as HTML file instead of Markdown file.

Include standalone HTML page in sphinx document

For most of my project's documentation I prefer a standard sphinx layout. However for the landing page I would prefer to use custom HTML/CSS/JS without any of the layout, TOC, or sidebars of the normal sphinx site. Is there a way to include a raw HTML standalone page in a sphinx-generated website in a way that completely disregards the normal layout of the rest of the site?
As a counter example I know that I can include raw HTML bits into a page using the following (see also this question)
.. raw:: html
:file: myfile-html
However this just embeds a file within the normal layout. I would like to have a completely standalone HTML page.
I just ran into this problem myself, and the way I solved it was to simply include the html file in my source/_static folder, then refer to it with a relative link.
So if source/_static/my_standalone.htm is the path where I have my non-generated HTML file, and the .rst file where I want to type my link is at source/otherfolder/index.rst, I write it like this in my rst:
Link to my non-Sphinx HTML file
===============================
To get to my standalone, non-generated HTML file,
just `click here <../_static/my_standalone.html>`_ now!

Make prepros watch Jade HTML include files

How can I make prepros watch HTML include files in Jade templates?
Gets a bit tiresome having to save the Jade file too after updating the included HTML. Codekit has this feature, any ideas how to get it working in Jade?
I didn't make it too, but I use simple hotfix which you might like.
Rename your example.html file to example.jade
Select your file contents and make indent.
Write any tag with a dot on top of the file, with no indents on the left (it is a top level tag).
span.
<html> ...
Now you can edit example.jade as a simple .html file. Hope it will help.

Parsing HTML file that ERB template creates

I am new to ruby on rails. I understand that I can parse html documents using nokogiri. I need to write the html that the erb template creates to a file. Then I will parse that with nokogiri.
I can view the html that is created via Inspect Element in my web browser. This is all well and good, but I am at a loss as to how I can write this HTML to a readable / parse-able file in my local project?
Please try this one
ERB.new(#template.source).result

linking html from another html file?

I know this may be a stupid question, im newer to this.
My menu bar takes over 1,000 lines in my html file. My client wants his index.html file organized so he can edit himself if needed.
I want to know if i can put my html for my menu in another files for instance in a file called : menu.html
and link in my index.html file by
<link href="../files/menu.html " type="text/html">
or in any other way that would work?
if you are using any programming language, use its code. For example, if you are using php
use
include_once('../files/menu.html');