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

Option for max attributes length #79

Merged
merged 2 commits into from
Nov 18, 2024

Conversation

ManUtopiK
Copy link
Contributor

@ManUtopiK ManUtopiK commented May 17, 2024

Hi!

I added an option to define the max length of the component's attributes.
I added tests for that.
The default stays the same 80 chars.
In the nuxt config, add this option:

mdcOptions: {
  maxAttributesLength: 100
},

I named the option maxAttributesLength but in fact, it's the length of the line, which include the name of the component and the decoration:

`::component{key="value"}` //  = 24 chars

Maybe we could found a better name for this. Naming is hard.
I didn't set this option in the experimental feature because it's a very small change...

Also, during development, maybe I found a possible issue that already exists before this merge request.
When this length is exceeded (default: 80), the attributes are converted to yaml format.
That's the point. But the fmAttributes are not properly filled and remains empty. You can see it in the snapshot.
This is not the case when we directly provide the component yaml props.
But if the length is exceeded, we are now in yaml style, so I think the fmAttributes should have the props.
It needs review because I don't know if it's the normal behavior...

Copy link

codesandbox bot commented May 17, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@farnabaz
Copy link
Collaborator

Thanks for the PR.

About the fmAttributes, I believe it is fine to keep fmAttributes empty on parsing.
parsing markdown and creating are separate from each other. Imagine If the limit in parse time is 80 and the limit for Stringify is 100.

@farnabaz farnabaz merged commit 94d9d97 into nuxtlabs:main Nov 18, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants