Skip to content

Github allows <li> without ancestors. #18

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

Closed
snikitin-qtl opened this issue Jun 23, 2020 · 4 comments · Fixed by #19
Closed

Github allows <li> without ancestors. #18

snikitin-qtl opened this issue Jun 23, 2020 · 4 comments · Fixed by #19

Comments

@snikitin-qtl
Copy link
Contributor

snikitin-qtl commented Jun 23, 2020

Hello,
we have found an issue in GitHub schema.

"li": [
"ol",
"ul"
],

It sanitizes the li tags without ul or ol ancestors.
Github is allowing that. Should I make a PR to fix that? or there is a rationale to keep it this way?

@wooorm
Copy link
Member

wooorm commented Jun 23, 2020

While you are correct that <li>a</li> on GitHub renders as a list item,

  1. Why would you want a <li> that is not in an <ol> or <ul>?
  2. GitHub does have code to remove <li> w/o <ol> / <ul> ancestor, which I based this schema on 🤔

@snikitin-qtl
Copy link
Contributor Author

Well,

  1. I would not, honestly. But the other users tend to put those things inline in markdown without wrapping it to the <ul> or <ol>. This case is a true story based on real events.
  2. Yeah. I'm not sure why the behavior is like that on Github. VSCode extensions for Markdown preview behaving like Github as well. 🤷‍♂️

I believe in this case - consistency is the goal.

@wooorm
Copy link
Member

wooorm commented Jun 23, 2020

<tbody>a</tbody>
<tfoot>b</tfoot>
<thead>c</thead>
<td>d</td>
<th>e</th>
<tr>f</tr>
<li>g</li>
<h7>h</h7>
<h8>i</h8>
<p>j</p>

Yields:

a b c d e f
  • g
  • h i

    j


    I also found that h7 and h8 are no longer supported. Are you interested in a PR that fixes li, and maybe also remove h7 and h8 too?

    @snikitin-qtl
    Copy link
    Contributor Author

    Sure, let me do that.

    wooorm pushed a commit that referenced this issue Jun 24, 2020
    Closes GH-18.
    Closes GH-19.
    
    Reviewed-by: Titus Wormer <[email protected]>
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Development

    Successfully merging a pull request may close this issue.

    2 participants