Black Lives Matter. Please consider donating to Black Girls Code today.

Showing a large list of string in html with some lines highlighted

How to show a string per line from a large list of strings with some lines highlighted?

A list of string is created from a file uploaded by a user and saved in a hidden div.
Then on callback from server the list of string is generated from hidden div. Some lines from list needs to be shown on webpage depending upon callback input arguments.

Current Approach:
I am adding ‘\n’ to end of each string and then joining all of them into one large string which is then shown using html.Pre().

Problem: Not able to highlight some particular lines.
I tried by adding <mark …intresting line… /mark> to lines to be highlighted.
And Then show using html.Div( ‘<br >’.join(modifiedListOfString) ) but this fails.

Please suggest appropriate method.

Try just putting each line in a Div:

   html.Div(line, style={'color': some_color}) for line in lines