GithubHelp home page GithubHelp logo

Comments (8)

arobase-che avatar arobase-che commented on June 11, 2024

from remark-attr.

bj00rn avatar bj00rn commented on June 11, 2024

@arobase-che thanks for quick reply! ๐ŸŒน

my problem is that the attributes does not seem to be picked up by my custom renderer function in react-markdown for images. For other elements such as em it works fine.

Issue might very well be specific to my use-case (react-markdown) though.

Below does not work:

![alt](img){ style="color:red" }

Below works fine:

Npm stand for *node*{style="color:red"} packet manager.

from remark-attr.

arobase-che avatar arobase-che commented on June 11, 2024

from remark-attr.

mrm007 avatar mrm007 commented on June 11, 2024

my problem is that the attributes does not seem to be picked up by my custom renderer function in react-markdown for images. For other elements such as em it works fine.

That's unfortunate. react-markdown won't pass the attributes down to your render function (see here). If you set a breakpoint on that line (assuming you have everything else configured correctly) you'll find node.data.hProperties populated by this plugin, but the information doesn't make it to your image renderer.

from remark-attr.

arobase-che avatar arobase-che commented on June 11, 2024

Thank you @mrm007 !

I understand the problem but can do anything from my side. I don't understand why they don't pass hProperties to react.

from remark-attr.

bj00rn avatar bj00rn commented on June 11, 2024

@mrm007 you sir, are correct! thank you for the pointers. Iยดve opened an issue to pass hProperties to renderers.

@arobase-che upon further investigation I realized that this behavior applies to all element types. like @mrm007 pointed out it's an issue with react-markdown.

Thanks again guys ๐ŸŽ

from remark-attr.

bj00rn avatar bj00rn commented on June 11, 2024

remarkjs/react-markdown#384

from remark-attr.

arobase-che avatar arobase-che commented on June 11, 2024

from remark-attr.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.