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

Parse figcaption contents #286

Open
3 tasks done
neverbot opened this issue May 7, 2024 · 2 comments
Open
3 tasks done

Parse figcaption contents #286

neverbot opened this issue May 7, 2024 · 2 comments

Comments

@neverbot
Copy link

neverbot commented May 7, 2024

Check List

  • I have already read README.
  • I have already searched existing issues.
  • I have already searched existing pull requrests.

Feature Request

When using the figcaption option,

marked:
  figcaption: true

generating images as

<figure>
  <img ... >
  <figcaption>...</figcaption>
</figure>

the figcaptions are usually intended to be rendered in some fancy way, including links or styles, etc.

I think it would be useful to parse its contents, changing from:

      return `<figure>${out}<figcaption aria-hidden="true">${text}</figcaption></figure>`;

to

      return `<figure>${out}<figcaption aria-hidden="true">${marked.parse(text)}</figcaption></figure>`;

If the figcaption has no special markdown, there is no difference. If we include some kind of markdown content, it will be parsed.

Additional context

No response

@uiolee
Copy link
Member

uiolee commented Jul 8, 2024

the "Permitted content" of <figcaption> is Flow content. But the rendering result of markdown can be any content. It seems like this would make things more complicated.

@neverbot
Copy link
Author

Could anybody break something using only markdown? And if they can... it's the user, they could be writing just bad html instead of bad markdown and parsing it (I am not sure I'm understanding the complications).

I've been using this change in a blog to add figcaptions with links to the original author of illustrations, think things like that would be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants