Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs-infra] Support rendering markdown outside of docs #37691

Merged
merged 1 commit into from
Jun 24, 2023

Conversation

@oliviertassinari oliviertassinari added the scope: docs-infra Specific to the docs-infra product label Jun 24, 2023
@oliviertassinari oliviertassinari added the bug 🐛 Something doesn't work label Jun 24, 2023
Comment on lines 124 to 129
const pageFilename = this.context
.replace(this.rootContext, '')
// Use .. as the docs runs from the /docs folder
const repositoryRoot = path.join(this.rootContext, '..');
const fileRelativeContext = path.relative(repositoryRoot, this.context)
// win32 to posix
.replace(/\\/g, '/');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix

@mui-bot
Copy link

mui-bot commented Jun 24, 2023

Netlify deploy preview

https://deploy-preview-37691--material-ui.netlify.app/

Bundle size report

No bundle size changes

Generated by 🚫 dangerJS against 5117922

@@ -157,7 +160,7 @@ module.exports = async function demoLoader() {
// The import paths currently use a completely different format.
// They should just use relative imports.
let moduleID = `./${demoName.replace(
`pages/${pageFilename.replace(/^\/src\/pages\//, '')}/`,
`pages/${fileRelativeContext.replace(/^docs\/src\/pages\//, '')}/`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly stylistic, but this line feels a bit strange. Isn't

`pages/${fileRelativeContext.replace(/^docs\/src\/pages\//, '')}/`

the same as

`${fileRelativeContext.replace(/^docs\/src\//, '')}/`

or even

`${path.posix.relative('docs/src', fileRelativeContext)}/`

?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, not sure why it was done this way.

Copy link
Member

@Janpot Janpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oliviertassinari oliviertassinari added new feature New feature or request and removed bug 🐛 Something doesn't work labels Jun 24, 2023
@oliviertassinari
Copy link
Member Author

oliviertassinari commented Jun 24, 2023

I noticed the button points to
https://github.com/mui/material-ui/blob/master/docs/data/material/getting-started/overview/overview.md
It could make sense to let it open the editor directly:
https://github.com/mui/material-ui/edit/master/docs/data/material/getting-started/overview/overview.md

@Janpot Ok, deal: #37695. I like how it saves one step. But also how it creates a more explicit user journey for those that are not familiar with GitHub. With this proposal, it shows a clear create a GitHub account page when you don't have one. Today, it's only a greyed edit button, with no clue what you are doing wrong.

Screenshot 2023-06-25 at 00 38 51

@oliviertassinari oliviertassinari merged commit 314c3d4 into mui:master Jun 24, 2023
23 checks passed
@oliviertassinari oliviertassinari deleted the docs-relative-path branch June 24, 2023 22:37
oliviertassinari added a commit to oliviertassinari/material-ui that referenced this pull request Jun 24, 2023
oliviertassinari added a commit to oliviertassinari/material-ui that referenced this pull request Jun 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request scope: docs-infra Specific to the docs-infra product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants