-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Docs schema #28
Docs schema #28
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting work in! Some initial feedback!
- [Security](#security) | ||
- [Related](#related) | ||
- [Contribute](#contribute) | ||
- [License](#license) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please run npm test
to format correctly
Follows [GitHub][] style sanitation. | ||
Follows [GitHub][] style sanitation. | ||
|
||
#### Overriding the default schema |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in a separate Example
section, see for example https://github.com/rehypejs/rehype-sanitize?tab=readme-ov-file#example
|
||
// === Output ======== | ||
// <h1 id="user-content-bohemian">I'm just a poor boy</h1> | ||
// <h2>From a poor family</h2> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, if you don’t use this package directly here, perhaps it should go in rehype-sanitize
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this example doesn’t match project style. Save it in an example.js
, run npm test
, and you’d get it back formatted
], | ||
... | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d like to actually fix this bug. So I’d prefer it if this example was unrelated to h2
and className
.
Appreciate the feedback. I'll try to fix these items tomorrow. |
Hey, I reviewed this a little more and I thought I'd share my thoughts..
This is a little bit misleading. Yes, it allows I know you mentioned fixing this "bug", but personally I don't see this as a bug. In English, to me this means
which is distinctly different than saying
Frankly I think both of these objectives should be supported. (Perhaps they already are, but I think only the first one is.)
Let me know how you want me to proceed. I meant to spend ~10 mutes on this but I'm already a few hours in haha. |
Which bug did you think I meant? For me this is about solving what these mean: const a = {
attributes: {
'*': ['className', 'x'],
h2: ['className', 'y']
}
}
const b = {
attributes: {
'*': ['className'],
h2: ['className', 'x']
}
} |
Yeah so, trying to solve this, runs into two actual problems. GH allows hast-util-sanitize/lib/schema.js Line 92 in fafff8a
However, GH normally doesn’t allow inputs at all. Only if they themselves generate them from tasklists ( hast-util-sanitize/lib/schema.js Lines 46 to 49 in fafff8a
So this behavior conflicts: if disabled is normally allowed to have any value, your wish also affects inputs. There’s one more case:
|
This comment has been minimized.
This comment has been minimized.
Hey, saw your latest commit. I'll test it out and let you know if I run into any problems. In regards to your question, I would assume the answers below const a = {
attributes: {
'*': ['className', 'x'], // every element can have a className of 'x'
h2: ['className', 'y'] // h2 can only have a className of 'y'. This supersedes the more general rule above
}
}
const b = {
attributes: {
'*': ['className'], // every element can have a className with any value
h2: ['className', 'x'] // h2 can only have a className of 'x'. This supersedes the more general rule above
}
} In other words, my assumption is that granular rules supersede (overwrite) generic rules. |
Initial checklist
Description of changes
TODO