-
Notifications
You must be signed in to change notification settings - Fork 154
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
Improve image and link nodes #156
Comments
Hey all 👋 - quick question re additional attributes. Does this mean Markdoc will be departing from the commonmark spec for images at the parsing phase? E.g. https://spec.commonmark.org/0.30/#example-571 |
@nvanexan potentially. Though depending on implementation specifics, we could make it a strict syntactical extension. Do you have concerns with going this direction? |
@mfix-stripe no, not really. I can see this being valuable. I had some hesitation about portability and compatibility when I saw the example above. For example, if I use those additional attributes in an .md file, does that make my images un-renderable in other contexts (e.g. GitHub, iAWriter, etc.)? And if I have files already implementing commonmark image patterns with a string for a title/caption |
@nvanexan if you are using and Markdoc specific syntax (e.g. annotations), then those will not show up correctly in GitHub or iAWriter, until they support Markdoc syntax. If you are not, and you just use standard Markdown (e.g. |
Are images nested in links part of this issue? I just ran into the issue of using images with links. The following markdown throws
|
I see this is on the roadmap as "ready", and I'm curious whether there's a general ETA for this feature at this point? |
Also following up on this: is the (Trying to fix the images here: onefact.org/five-boro-bike-tour/jaan) |
@jaanli you can use Next.js's |
This has come up a few times recently, so I want to revisit it and get some opinions about syntax. There are a bunch of different approaches to this problem in different Markdown engines and environments. There are three approaches that I'm currently considering:
I'd like to get some feedback on which of these options the community likes better. I personally am leaning towards the second one. I think the first one is a little cleaner from a readability standpoint, but the second one is a lot more consistent with Markdoc's existing design and it avoids having to introduce new syntax or parser modifications that may be difficult for other implementations to support. |
Here's my two cents on the syntax suggestions given by @rpaul-stripe. I think context is valuable here - so I should clarify that I'm aiming enable open source contributors to our documentation as well as internal folks who have no knowledge of markdoc. I like suggestion (3) in theory the most, but in light of the technical challenges and also potential issues with the lack of a space becoming a critical piece of syntax which AFAIK isn't very markdown-y in inline elements. In light of that I think (2) is a good suggestion because:
Thank you for your work on this 🐳 |
Do you know whether it's possible to have Markdoc support this standard Next.js feature of the From the docs - https://nextjs.org/docs/app/building-your-application/optimizing/images -
Attempt at a minimal reproducible example: Commit here adding a Markdoc component given your advice: It seems malformed and despite the documentation claiming that the image size is read automatically, I haven't been able to figure out how to enable this feature. Appreciate any help on this -- thank you @rpaul-stripe & @mfix-stripe! I'm getting a little closer but still struggling & need to complete my doula certification in the upcoming months. It's a huge help having @markdoc to rely on as I open source several birth support pages. |
@jaanli you should be able to use the Next.js Image component by adding an // ./markdoc/tags.js
import Image from 'next/image'
export.image = {
render: Image,
// ...
} However, I am going to add a default image tag to |
I would vote on (2) as well. Mainly because it doesn't break the content if used with another markdown parser. |
figure
instead of ap
, but this behavior would be possible to override in a custom node definition’s transform function![alt](/href width=10 height=10 foo={arbitrary: "markdoc stuff"})
The text was updated successfully, but these errors were encountered: