Skip to content

Preview after packaging, parsing error appears when refreshing page #195

@codersjj

Description

@codersjj

Describe the bug

I wrote several code blocks of html in the markdown document:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>document1</title>
</head>
<body>
  <script>

  </script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>document2</title>
</head>
<body>
  <script>

  </script>
</body>
</html>

then previewed after packaging.

From the homepage, I entered the page corresponding to the markdown document, which was normal, but at this time if I refresh the page, a parsing error will appear.

image

I think it's because the </script> in the code block was parsed as the ending tag of the <script> where window.ISLAND_PAGE_DATA is located, and then the content after that could not be parsed correctly.

Reproduction

refresh-parse-error

See: https://codesandbox.io/p/sandbox/island-app-script-issue-qy5fpq?file=%2Fisland-app%2Fdocs%2Farticle%2Fastro.md%3A24%2C7

Expected behavior

parse </script> correctly

System Info

-

Additional context

No response

Validations

  • Read the docs
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions