React-styleguidist: pagePerSection links break when section name includes a "/"

Created on 11 Apr 2019  路  9Comments  路  Source: styleguidist/react-styleguidist

Current behavior

If you have a forward slash in your section name, the pagePerSection links are all broken, resulting in "Page not found". Removing the forward slashes in the names fixes the issue.

To reproduce

Simple styleguide.config.js:

module.exports = {
    pagePerSection: true,
    sections: [{
        name: '@foo/components'
    }, {
        name: '@bar/components'
    }]
};

Expected behavior

Links should work for any text in a section name field. Probably just need to urlencode the string.

bug released

All 9 comments

Feel free to send a pull request with a fix.

:tada: This issue has been resolved in version 9.1.7 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

This appears to have fixed the top level section link, but any sub-links within that section are still unencoded and result in "Page not found".

@stonebk could you please give an example of the config file to get an exact idea of sub-links you are talking about?
I was able to reproduce your problem by applying your config from the description on Styleguidist sections example. I'd be glad to fix this as well.

@mendrew it looks something like this:

{
    "webpackConfig": { ... },
    "styleguideComponents": { ... },
    "title": "Foundation Team APIs",
    "usageMode": "expand",
    "require": [ ... ],
    "pagePerSection": true,
    "sections": [
        {
            "name": "Introduction",
            "content": "docs/introduction.md"
        },
        {
            "name": "@zillow/zrs-activation",
            "sections": [
                {
                    "name": "Components",
                    "components": "/Users/stonebk/foundation-site/node_modules/@zillow/zrs-activation/src/components/**/[A-Z]*.{js,jsx,ts,tsx}"
                }
            ]
        },
        {
            "name": "@zillow/zrs-profile",
            "sections": [
                {
                    "name": "Components",
                    "components": "/Users/stonebk/foundation-site/node_modules/@zillow/zrs-profile/src/components/**/[A-Z]*.{js,jsx,ts,tsx}"
                }
            ]
        },
    ]
}

With that config, both the "Components" link under the section name, and all the links under "Components" have unencoded urls.

Awesome, thank you, I'll take a look.

Hi @stonebk. The fix has been released in v9.1.10.
Could you please take a look?

@mendrew, all better now! Thanks so much!

Awesome, you're welcome! 馃檪

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vchoisk picture vchoisk  路  3Comments

okonet picture okonet  路  3Comments

davidjb picture davidjb  路  3Comments

stcherenkov picture stcherenkov  路  3Comments

lyz810 picture lyz810  路  3Comments