-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
WIP: Add Markdown Plugin #3384
WIP: Add Markdown Plugin #3384
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 |
---|---|---|
@@ -1,24 +1,23 @@ | ||
const assert = require('assert'); | ||
const path = require('path'); | ||
const {bundle, assertBundleTree, outputFS} = require('@parcel/test-utils'); | ||
const {bundle, assertBundles, outputFS} = require('@parcel/test-utils'); | ||
|
||
describe.skip('markdown', function() { | ||
it('should support bundling Markdown', async function() { | ||
describe('markdown', function() { | ||
it.only('should support bundling Markdown', async function() { | ||
let b = await bundle( | ||
path.join(__dirname, '/integration/markdown/index.md') | ||
); | ||
|
||
await assertBundleTree(b, { | ||
name: 'index.html', | ||
assets: ['index.md'], | ||
childBundles: [ | ||
{ | ||
type: 'png', | ||
assets: ['100x100.png'], | ||
childBundles: [] | ||
} | ||
] | ||
}); | ||
await assertBundles(b, [ | ||
{ | ||
name: 'index.html', | ||
assets: ['index.md'] | ||
}, | ||
{ | ||
type: 'png', | ||
assets: ['100x100.png'] | ||
} | ||
]); | ||
|
||
let files = await outputFS.readdir(path.join(__dirname, '/dist')); | ||
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 test fails at this line with FSError: ENOENT: /..../parcel/packages/core/integration-tests/test/dist does not exist Where exactly is the output supposed to be? Is the the Markdown Plugin I converted not configured properly? Thoughts? 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. You should use the |
||
let html = await outputFS.readFile( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "@parcel/transformer-markdown", | ||
"version": "2.0.0-alpha.1.1", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/parcel-bundler/parcel.git" | ||
}, | ||
"main": "src/MarkdownTransformer", | ||
"engines": { | ||
"parcel": "^2.0.0-alpha.1.1" | ||
}, | ||
"dependencies": { | ||
"@parcel/plugin": "^2.0.0-alpha.1.1", | ||
"marked": "^0.7.0" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// @flow | ||
|
||
import {Transformer} from '@parcel/plugin'; | ||
import marked from 'marked'; | ||
|
||
export default new Transformer({ | ||
async transform({asset}) { | ||
asset.type = 'html'; | ||
let code = await asset.getCode(); | ||
asset.setCode(marked(code)); | ||
return [asset]; | ||
} | ||
}); |
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.
One thing I have also found helpful is using the
--grep
feature in mocha to regex to the specific test I want to run.