-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1068 from daniel-ac-martin/add-mdx-test
First class support for Markdown and MDX
- Loading branch information
Showing
8 changed files
with
175 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export const pageLoader = require.context('./pages', true, /\.([jt]sx?|html)$/i, 'sync'); | ||
export const pageLoader = require.context('./pages', true, /\.([jt]sx?|mdx?|html)$/i, 'sync'); | ||
export default pageLoader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const pageWorks = () => ( | ||
it('is the correct page', () => { | ||
cy.contains('Markdown test').should('be.visible'); | ||
cy.contains('Hello world!').should('be.visible'); | ||
}) | ||
); | ||
|
||
describe('Markdown', () => { | ||
describe('when visiting the page directly', () => { | ||
it('successfully loads', () => { | ||
cy.visit('/md'); | ||
}); | ||
|
||
pageWorks(); | ||
}); | ||
|
||
describe('when visiting the page indirectly', () => { | ||
before(() => { | ||
cy.visit('/'); | ||
cy.contains('Md').click(); | ||
}); | ||
|
||
pageWorks(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const pageWorks = () => ( | ||
it('is the correct page', () => { | ||
cy.contains('MDX test').should('be.visible'); | ||
cy.contains('Hello world!').should('be.visible'); | ||
cy.contains('React supported').should('be.visible'); | ||
}) | ||
); | ||
|
||
describe('Markdown', () => { | ||
describe('when visiting the page directly', () => { | ||
it('successfully loads', () => { | ||
cy.visit('/mdx'); | ||
}); | ||
|
||
pageWorks(); | ||
}); | ||
|
||
describe('when visiting the page indirectly', () => { | ||
before(() => { | ||
cy.visit('/'); | ||
cy.contains('MDX').click(); | ||
}); | ||
|
||
pageWorks(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export const pageLoader = require.context('./pages', true, /\.([jt]sx?|html)$/i, 'sync'); | ||
export const pageLoader = require.context('./pages', true, /\.([jt]sx?|mdx?|html)$/i, 'sync'); | ||
export default pageLoader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Markdown test | ||
============= | ||
|
||
Hello world! | ||
|
||
[Markdown](/md) has support for basic typography such as **bold** and _italic_. You can even use them **_together_**. | ||
|
||
Ordered lists | ||
------------- | ||
|
||
### Reasons to be cheerful: | ||
|
||
1. One | ||
2. Two | ||
3. Three | ||
|
||
## Disordered lists | ||
|
||
- A | ||
- B | ||
- C | ||
|
||
## Block quotes | ||
|
||
> **My quote** | ||
> | ||
> > Embedded | ||
## Code | ||
|
||
We can provide `code inline`, or in a block: | ||
|
||
``` | ||
MY CODE | ||
MORE CODE | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { BackLink, NavigationMenu, Panel } from '@not-govuk/components'; | ||
|
||
export const title = 'MDX'; | ||
|
||
<div className="govuk-grid-row"> | ||
<div className="govuk-grid-column-one-quarter"> | ||
<NavigationMenu | ||
items={[ | ||
{ | ||
href: "/", | ||
text: "Home", | ||
}, | ||
{ | ||
href: "/html", | ||
text: "HTML", | ||
}, | ||
{ | ||
href: "/md", | ||
text: "Markdown", | ||
}, | ||
{ | ||
href: "/mdx", | ||
text: "MDX", | ||
}, | ||
]} | ||
/> | ||
</div> | ||
<div className="govuk-grid-column-three-quarters"> | ||
<BackLink /> | ||
|
||
MDX test | ||
======== | ||
|
||
Hello world! | ||
|
||
[Markdown](/md) has support for basic typography such as **bold** and _italic_. You can even use them **_together_**. | ||
|
||
Ordered lists | ||
------------- | ||
|
||
### Reasons to be cheerful: | ||
|
||
1. One | ||
2. Two | ||
3. Three | ||
|
||
## Disordered lists | ||
|
||
- A | ||
- B | ||
- C | ||
|
||
## Block quotes | ||
|
||
> **My quote** | ||
> | ||
> > Embedded | ||
## Code | ||
|
||
We can provide `code inline`, or in a block: | ||
|
||
``` | ||
MY CODE | ||
MORE CODE | ||
``` | ||
|
||
--- | ||
|
||
## MDX | ||
|
||
<Panel | ||
classModifiers="confirmation" | ||
title="React supported" | ||
> | ||
You can use React components in your MDX pages. | ||
</Panel> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export const pageLoader = require.context('./pages', true, /\.([jt]sx?|html)$/i, 'sync'); | ||
export const pageLoader = require.context('./pages', true, /\.([jt]sx?|mdx?|html)$/i, 'sync'); | ||
export default pageLoader; |
420e1c9
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.
🎉 Published on https://not-gov.uk as production
🚀 Deployed on https://66d88f17e19000fa1660ee74--notgovuk.netlify.app