[Fix] parseMarkdown startDelimiter#24
Conversation
|
I have found other issues related to Windows 10 :
Because Unibit works great on Linux, I'll continue to use it in the right way. Thank you for sharing this library, it's very useful and working well (on real OS) ! :) |
smnh
left a comment
There was a problem hiding this comment.
@NicolasRoehm thanks for the PR.
Good catch with the EOL.
Regarding path.sep, please see comments inline
| let pageUrl = _.trim(_.get(page, 'url'), path.sep); | ||
| pageUrl = prettyUrl(pageUrl); | ||
| const pageUrlParts = _.split(pageUrl, '/'); | ||
| const pageUrlParts = _.split(pageUrl, path.sep); |
There was a problem hiding this comment.
Here we are handling page URL paths. URLs always use forward slash disregards to the underlying system /.
On windows system, the path.sep will be \ so the logic will not work for URL paths
There was a problem hiding this comment.
Here the path.sep is not about URL but rather about file routing/parsing.
On windows system, the page.url value prints \\blog\\author\\dianne-ameter.
- When we try to remove the leading and trailing
/character(s) with_.trim, nothing happens :pageUrlcontains\\blog\\author\\dianne-ameterinstead ofblog\\author\\dianne-ameter.
- Then we split the url parts by the hardcoded
/, so we get :pageUrlParts = [ '\\blog\\author\\dianne-ameter' ]instead of['blog', 'author', 'dianne-ameter'].
This causes the blog page to not list any blog posts and all subdirectory routes are skipped/broken.
There was a problem hiding this comment.
Interesting,
Then I guess the root cause of this bug is somewhere before the execution of this code.
The page.url should never have OS specific separators and should always have standard URL forward slash - /.
Maybe the code that constructs the original url property?
I was not able to build the pages on Windows 10 using
unibit buildorunibit develop.It always outputs
[Unibit] Generating 0 pages...I removed the
\non each startDelimiter and it now works.Surprisingly, endDelimiter works fine as is, for example,
\n---.