We have our documentation on a hugo instance and people can change it by committing markdown files to our repo. This is normally great but some people need to mention windows paths in their markdown files.
In both examples, the \u will be treated as a \u character sequence, hugo logs “Uncaught SyntaxError: malformed Unicode character escape sequence” into the browser console and the search is broken.
I have not found a way to make hugo happy. I tried \\ to escape the \, I tried \ \u005C and whatever I could think of but the problem persists. Telling the users to use a better operating system also didn’t work.
Does anyone have an idea how to overcome this issue or configure that we don’t want unicode sequences interpreted but rather want to print the text, regardless of \u or not? I think it is somehow related to the yaml parser that hugo uses but it should not be something unusual that people document windows paths with backslashes and \u should also not be uncommon. So I’m really surprised that I can’t find anything about this topic online.
Hi @jmooring , thank you for taking the time to answer my question.
I’m a n00b when it comes to hugo and I came to the project when all of this was already in existence. It’s still a bit hard to know which parts are customizations and which belong to hugo itself. I assume the theme is modified but I don’t know which theme was modified.
The paths are in the body. But when you mention the search indexing, I think this could be a good starting point. I had thought it would be something that belongs to vanilla hugo.
Got it, I’m so stupid… Thanks for pointing me into the right direction. It was rather obvious, now that I think about it but that’s how it is.
The search indexing does a .toLowerCase() which fails on the \u character sequence.
“c:\something\users\blabla”.toLowerCase() → Uncaught SyntaxError: malformed Unicode character escape sequence
As you said, a javascript error, nothing to do with Hugo. Thanks again.