Bug #6310
closedInteractive Saxon doc: Coming from search, code samples render with spaces missing
100%
Description
In Saxon documentation, code blocks are not being rendered as expected when I reach the page from a list of search results.
I'm attaching two screen captures (from Firefox 121.0 on Windows, though I see the same issue in Edge 120.0.2210.91 on Windows, too).
Reproduction steps:
- Start from https://www.saxonica.com/documentation12/index.html
- Enter saxon:as in the search field and click the magnifying glass
- Scroll through the search results and click the result for "saxon:as"
- Notice that the page has three code blocks that have horizontal scroll bars and are missing spaces in key places, such as between one attribute value and an adjacent attribute name.
- Copy the URL from the browser's address bar ( https://www.saxonica.com/documentation12/index.html#!extensions/attributes/as ) and paste it into a new browser tab. The rendering looks as expected. Another way to make the rendering look as expected is to reload the page in the original tab (which makes the set of search results go away).
These steps use a particular documentation page, but I see the same effect on other pages with code blocks.
Files
Updated by Debbie Lockett 11 months ago
- Category set to Documentation
- Assignee set to Debbie Lockett
- Applies to branch 12, trunk added
Thanks for letting us know, and the clear report!
I updated the Saxon 12 interactive documentation with the 12.4 release (2023-11-29) to use syntax highlighting for code samples with Prism. But it looks like it isn't working as expected after a search. I'll look at getting it fixed.
Updated by Debbie Lockett 11 months ago
- Status changed from New to Closed
- % Done changed from 0 to 100
- Fix Committed on Branch 12, trunk added
Fix committed on saxon12 and main branches (for both the main Saxon 12 doc interactive app, and the SaxonC 12 docs):
Fix in the documentation app stylesheet findtext.xsl so that no attempt is made to highlight the search term in sample code (i.e. content of pre
elements). (The page content is updated to highlight the search term with the "highlight-text" mode.) This fixes the problem with losing formatting (with spaces) in sample code.
Unfortunately, now if the search term is found in sample code in the page, it will not be highlighted, since this does not work nicely with the syntax highlighting with Prism. I think we're just going to have to live with that. The example provided by Amanda demonstrates why doing better is hard - "saxon:as" in the sample code becomes mixed content in the Prism markup, and handling that will become messy.
Committed rebuilt app SEFs to the www-saxonica-com repo, to fix the online docs.
Please register to edit this issue