-
Notifications
You must be signed in to change notification settings - Fork 16
feat: image components! #857
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
Conversation
kellyjosephprice
left a comment
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.
This looks good. But I think we need to replace the magic block stuff with some equivalent MDX?
Also, would you try enabling tests in these files:
__tests__/components/test.js
__tests__/flavored-compilers/images.test.js
__tests__/index.test.js
|
@kellyjosephprice okay that test is being a pain and we can address it later :P |
kellyjosephprice
left a comment
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.
Mostly LGTM, accept for the compiler's using the old style syntax.
processor/compile/image.ts
Outdated
| visitors.image = function compile(node: Image, ...args: any[]): string { | ||
| if (node.data?.hProperties?.className === 'emoji') return node.title; | ||
|
|
||
| const { align, className, width } = node.data?.hProperties || {}; | ||
| const complexImage: boolean = Boolean(width) || Boolean(className) || Boolean(align); | ||
| if (complexImage) return `<Image ${{...node.data?.hProperties}} />`; | ||
|
|
||
| return originalImageCompiler.call(this, node, ...args); | ||
| }; |
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.
This is the old (remark-stringify@8) syntax. Here's an example of the a new-style plugin: https://github.com/readmeio/markdown/blob/beta/processor/compile/gemoji.ts#L1-L13
Also, my code-tabs PR refactors it a little: https://github.com/readmeio/markdown/pull/871/files#diff-3dd941d5e7f0c5b195b587d965c70f0e20f53da74c480b7d208e555b0dca2715R1-R12
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.
I guess I wasn't aware of this 3 weeks ago...
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.
hah! awesome--i had seen the syntax change but wasn't sure if that was just gemoji related
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.
It's like, well typed, but I could only figure it out by reading the remark source. 😖
| "release.dry": "npx semantic-release --dry-run", | ||
| "start": "webpack serve --open --mode development --config ./webpack.dev.js", | ||
| "test": "vitest", | ||
| "test.ui": "vitest --ui", |
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.
:neat:
| "node_modules", | ||
| "dist" | ||
| ] | ||
| } |
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.
my json formatter has opinions apparently
kellyjosephprice
left a comment
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.
LGTM!
🙏 Would you uncomment this line: https://github.com/readmeio/markdown/blob/beta/__tests__/browser/markdown.test.js#L20
Then run make updateSnapshot
heh we have dueling default fonts |
Ugh, docker was supposed to fix this. |
haha i know, i just tried to cheat and not run it in a container but then i gave in |
This PR was released!🚀 Changes included in v6.75.0-beta.29 |

🧰 Changes
MDXify the
Imagecomponent🧬 QA & Testing