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

Others Attrs and Style #79

Open
linspw opened this issue May 24, 2023 · 1 comment
Open

Others Attrs and Style #79

linspw opened this issue May 24, 2023 · 1 comment

Comments

@linspw
Copy link

linspw commented May 24, 2023

Hello everything is fine?
Very cool library!

Is there any option to pass all the attributes that are in the node to the attr of the html or style?

For example:

Transforming:

  {
      "type": "paragraph",
      "content": [{"type": "text", "text": "Hello"}],
      "attrs": {"textAlign": "left"},
  }

To:

<p style="text-align: left">Hello</p>

I thank the attention

@rajatsingla
Copy link
Contributor

Hello,

how about below?

Transforming:

  {
      "type": "paragraph",
      "content": [{"type": "text", "text": "Hello"}],
      "attrs": {"style": {"textAlign": "left"}},
  }

To:

<p style="text-align: left">Hello</p>

Side note: For style change you might wanna use mark instead of attrs, in this particular case maybe a new mark can be introduced called left or align_left.

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