Is it possible to store/display html markup in node value?

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

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:

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.

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

1 Like