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

The parseFileStructureFromContent works wrong sometimes #58

Open
alexprey opened this issue Feb 2, 2021 · 3 comments
Open

The parseFileStructureFromContent works wrong sometimes #58

alexprey opened this issue Feb 2, 2021 · 3 comments
Labels
bug Something isn't working priority:low
Milestone

Comments

@alexprey
Copy link
Collaborator

alexprey commented Feb 2, 2021

The following input of markup returns the wrong output for script blocks

<script>
const example = `
    <script>
    </script>
`;
</script>
@alexprey alexprey added the bug Something isn't working label Feb 2, 2021
@soft-decay
Copy link
Contributor

soft-decay commented Feb 10, 2021

I was browsing the Svelte issues and actually, this is not a bug:
sveltejs/svelte#5810

If a developer wants to put </script> in a string literal or comment, it has to be escaped.

@alexprey
Copy link
Collaborator Author

The following code should be correct for svelte, but this parser failed there:

<Panel title="Basic tabs" shadow={true}>
  <Tabs bind:items={items}/>
  <br><br>
  <strong>Active tab:</strong> {activeTab1[0].title}
  <br>
  <br>

  <Code>
    {@html highlight(
      '<script> \n' +
      '   const items = [ \n' + 
      '     { title: "Tab 1", active: true }, \n' +
      '     { title: "Tab 2", active: false }, \n' +
      '     { title: "Tab 3", active: false }, \n' +
      '     { title: "Tab 4", active: false }, \n' +
      '   ]; \n' +
      '</script> \n\n' +
      '<Tabs bind:items={items} />')}
  </Code>
</Panel>

alexprey added a commit that referenced this issue Feb 12, 2021
@alexprey
Copy link
Collaborator Author

The test was added in test\unit\helpers\helpers.spec.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority:low
Projects
None yet
Development

No branches or pull requests

2 participants