Python Forum

Full Version: [Solved] Browser won't parse text from yaml loaded into Jinja
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone,

I'm loading a yaml file into Flask with

with open('myfile.yml', 'r') as file:
    TheYaml = yaml.safe_load(file)
In my .html template I'm loading what I need from this yaml like this with Jinja

{{ [TheYaml["akey"] }}
The value of this key is loaded in the html but any HTML tag for exemple <br> is not parsed by the browser !
I know about the Jinja escaping (I've try everything) but I think the problem lay somewhere else..

It's weird as in the Browser developer tools, this text if fully grey-out (even the html tags... )

Any ideas ?

Edit:

I've run
type([TheYaml["akey"])
Output:
<class 'str'>
so everything look ok.. Wall

edit2:
I've try without yaml

like this
return render_template('content.html', testing={"a_test": "let <b>try</b> it"})
I have the same problem.. the <b> and </b> are not parsed. so the problem si not the yaml.. but the Jinja/ Flask ??
Don't bother I solved it !
I will write the solution later on...