Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-16-2019 10:18 AM
Greetings,
I am using GrapheneDB Neo4j 3.2 and node.js on heroku.
Is it possible to store html markup in a node's property in order to have that html displayed/respected in the app displaying this node/property?
Match (n:Term)
Set n.Notes = 'Here is some text.<br>Here is some text on another line.'
Then in the app display the above text would show on 2 different lines?
Many Thanks,
Keith
Solved! Go to Solution.
02-16-2019 01:01 PM
Yes, you can definitely store html markup in a property. You'd probably use <br>
tags to separate lines or use escape character \n
.
More on escape characters:
https://neo4j.com/docs/cypher-manual/current/syntax/expressions/#cypher-expressions-string-literals
02-16-2019 01:01 PM
Yes, you can definitely store html markup in a property. You'd probably use <br>
tags to separate lines or use escape character \n
.
More on escape characters:
https://neo4j.com/docs/cypher-manual/current/syntax/expressions/#cypher-expressions-string-literals
02-16-2019 01:40 PM
Thanks so much for the help Ryan!
I've improved my original question (needed to escape the <br> code there so the tag would show in my question).
So it's normal to put html markup in a Neo4j node property and have it respected by an 'app'?
Is it more likely that my Node.js is not respecting the html? If that's the case, I'll switch forums.
02-16-2019 06:40 PM
It’s not abnormal in smaller quantities.
I’m not a node.js expert, but i’d guess that something is treating your html as “unsafe” user input and automatically escaping it in order to prevent some types of attacks (user-written html infecting harmful javascript code as an example)
If you know it is safe, you sometimes need to indicate that to templating languages (ie python flask requires that you indicate the template variables are safe content, else it’ll be escaped)
Cheers
Ryan
All the sessions of the conference are now available online