To change the way that WebHelp styles search results, you need to modify the file whtopic.js. In the top of whtopic.js is the variable
gsHiliteSearchSetting. This variable has three values separated by commas. The first value controls if highlighting is possible. If the value is enable, highlighting is enabled. Any other value will disable highlighting. When highlighting is enabled, a user can still disable the highlighting by deselecting the checkbox in the search pane.
The second value in
gsHiliteSearchSetting is the background colour of the highlighted string. The third variable is the text colour of the highlighted string.
If you want to style the string further, such as adding borders, you need to modify the function DomTextNode. In this function, find the following lines:
- RoboHelp 8: 299-300
- RoboHelp 9: 306-307
s_strHlStart = "<font style='color:" + gsTextColor + "; background-color:" + gsBkgndColor + "'>"; s_strHlEnd = " </font>";
To apply any highlight styling, simply add you styling after
gsBkgndColor + ". Be sure to first add a semi-colon after
gsBkgndColor + " to separate your styles. For instance, the image showing the highlight does three things: Add a blue border, add a yellow background and transform the string to uppercase. To get this result, change the styling as follows:
s_strHlStart = "<font style='color: #000; background: yellow; border: 3px solid #045abb; text-transform: uppercase;'>";
Alternatively, add a class to the font tag and style the highlight using your style sheet.
Note: The colours for the text and the highlight are set in the variable
gsHiliteSearchSetting, but are stored in the variables
gsTextColor. Setting these variables in the top of the file has no effect as the variables are always filled with the values from
gsHiliteSearchSetting. This is done by the function