Try this.
'use strict';
function on_main_menu(index) {
switch (index) {
case 1:
let tfo1 = fb.TitleFormat("%comment%"); //define the field you want the text to get displayed
let window_x = 50; //define window x position
let window_y = 50; //define window y position
let window_w = 500; //define window width
let window_h = 600; //define window height
let tfo2 = fb.TitleFormat("%filename_ext%");
let html_data= "";
html_data += "<html>";
html_data += "<head>";
html_data += "<title>" + tfo2.EvalWithMetadb(fb.GetFocusItem()) + "</title>";
html_data += "<style rel=\"stylesheet\" type=\"text/css\">";
html_data += "body {font-family: Segoe UI; font-size: 16px;}";
html_data += "</style>";
html_data += "</head>";
html_data += "<body>";
html_data += tfo1.EvalWithMetadb(fb.GetFocusItem()).replace(/(?:\r\n|\r|\n)/g, '<br>');
html_data += "</body>";
html_data += "</html>";
utils.ShowHtmlDialog(window.id, html_data,{x:window_x,y:window_y,width:window_w,height:window_h,resizable:true,scroll:true});
break;
}
}