-
Notifications
You must be signed in to change notification settings - Fork 19
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
Create author.mdx #384
Create author.mdx #384
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
To author a page using MDX in Mosaic and showcase commonly used components such as Callout and Tile, follow these steps: | ||
|
||
1. Install dependencies: Ensure you have Node.js and npm installed on your machine. Then, navigate to the root directory of the cloned `mosaic` repository and run the following command to install the necessary dependencies: | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
2. Create a new MDX page: In the `docs` directory of the `mosaic` repository, create a new MDX file with a `.mdx` extension. For example, `my-page.mdx`. | ||
|
||
3. Author the page using MDX syntax: Open the newly created `.mdx` file in a text editor and use MDX syntax to write the content. You can include Markdown and Mosaic components in the document. Here's an example: | ||
|
||
```mdx | ||
import { Callout, Tile } from '@jpmorganchase/mosaic'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be from |
||
|
||
# My Page | ||
|
||
This is an example page written in MDX using Mosaic components. | ||
|
||
## Callout Component | ||
|
||
<Callout variant="info"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no "info" variant for the |
||
This is an informational callout. | ||
</Callout> | ||
|
||
## Tile Component | ||
|
||
<Tile title="Tile 1"> | ||
This is the content of Tile 1. | ||
</Tile> | ||
|
||
<Tile title="Tile 2"> | ||
This is the content of Tile 2. | ||
</Tile> | ||
``` | ||
|
||
In this example, the `Callout` and `Tile` components are imported from `@jpmorganchase/mosaic` and used within the MDX document. You can include any other commonly used components in a similar manner. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wrong package name again, should be from @jpmorganchase/mosaic-components |
||
|
||
4. Add the page to the sidebar: To display the newly created page in the sidebar navigation, you need to update the `sidebars.js` file located in the `.vuepress` directory. Open the `sidebars.js` file and add an entry for your page, specifying the title and file path. For example: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. None of this is required....the page will be found by the Also not clear why you mention |
||
|
||
```javascript | ||
module.exports = { | ||
// other sidebar entries | ||
'Guide': [ | ||
// other guide entries | ||
'docs/my-page' | ||
], | ||
}; | ||
``` | ||
|
||
5. Start the development server: Run the following command in the root directory of the `mosaic` repository to start the development server: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to be targeting how you would write a doc for this repo but it should be targeted at people who have generated a new mosaic site. |
||
|
||
```bash | ||
npm run dev | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mosaic sites should be run locally using |
||
``` | ||
|
||
This command will start the server and generate the static site. You can then view the site in your browser by navigating to `http://localhost:8080`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Might want to direct people to the page they just authored as it is likely to be want they most want to see. |
||
|
||
6. View the authored page: Once the development server is running, you can access the page you created by clicking on the sidebar navigation link. The MDX content will be rendered with the specified Mosaic components. | ||
|
||
Note: The example provided assumes that the `mosaic` repository uses MDX2 for creating documents. Please refer to the repository's documentation or the specific project requirements to ensure the correct version and usage of MDX. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use
yarn
as the package manager notnpm