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

feat(mdx): use mdx for docs #1753

Merged
merged 16 commits into from Apr 15, 2019
Merged

feat(mdx): use mdx for docs #1753

merged 16 commits into from Apr 15, 2019

Conversation

@redallen
Copy link
Contributor

redallen commented Apr 11, 2019

What: Use MDX for docs instead of markdown-remark with our own custom plugins.

  • .md files are now hot-reloaded
  • Anything can be imported into a .md file, like per-example CSS!
  • <pre> tags have been replaced with <div> tags (towards #1724 )

Additional issues: If you're a doc maintainer, now your docs are now MDX files. MDX is JSX in markdown, so you have a full-fledged React component to work with inside your MDX file. The minimum to get your examples working is this:

---
title: 'title'
cssPrefix: 'pf-c-prefix'
---
// Add imports below (need newlines before + after)...

import { Avatar } from '@patternfly/react-core';
import avatarImg from './examples/avatarImg.svg';

## Simple Avatar Example
```js
// The following imports are used to make copy-pasting examples possible. They have no effect.
import React from 'react';
import { Avatar } from '@patternfly/react-core';
import avatarImg from './examples/avatarImg.svg';

// You can have raw JSX, a function, or class rendered here using react-live
<Avatar src={avatarImg} alt="avatar"></Avatar>
```
// You can even render the component outside of the code block to appear inline in the docs!
<Avatar src={avatarImg} alt="avatar"></Avatar>
@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Apr 12, 2019

Codecov Report

Merging #1753 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1753   +/-   ##
=======================================
  Coverage   82.75%   82.75%           
=======================================
  Files         601      601           
  Lines        6645     6645           
  Branches       72       72           
=======================================
  Hits         5499     5499           
  Misses       1119     1119           
  Partials       27       27
Flag Coverage Δ
#patternfly3 84.87% <ø> (ø) ⬆️
#patternfly4 79.42% <ø> (ø) ⬆️
#patternflymisc 95.68% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 892b68a...e847c9b. Read the comment docs.

@patternfly-build

This comment has been minimized.

Copy link
Contributor

patternfly-build commented Apr 12, 2019

@jschuler jschuler mentioned this pull request Apr 12, 2019
5 of 12 tasks complete
@redallen redallen self-assigned this Apr 12, 2019
@redallen redallen requested review from dgutride, ibolton336, jschuler and mcoker Apr 12, 2019
@mcoker

This comment has been minimized.

Copy link
Contributor

mcoker commented Apr 12, 2019

Looks good to me visually. Removing the <pre> solved a lot of typography and spacing issues. Let me know if there is something specific you'd like me to review.

@redallen

This comment has been minimized.

Copy link
Contributor Author

redallen commented Apr 12, 2019

That's all I wanted, verifying the <pre> changes did something. Thanks!

Copy link
Contributor

mcoker left a comment

🥇

@patternfly-build

This comment has been minimized.

Copy link
Contributor

patternfly-build commented Apr 15, 2019

@redallen

This comment has been minimized.

Copy link
Contributor Author

redallen commented Apr 15, 2019

@tlabaj Can you check if your recent DataList changes work in the doc preview that just deployed?

@mcoker
mcoker approved these changes Apr 15, 2019
Copy link
Contributor

mcoker left a comment

👍

@redallen redallen merged commit a03ecd0 into patternfly:master Apr 15, 2019
2 checks passed
2 checks passed
ci/circleci: build Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.