Skip to content

Content of <script> tags is escaped when they are inside html tags and 'sanitize: false' #257

Closed

Description

@andreyvolokitin

If for example we have this html in our markdown:

<div>
    <script>if (5 > 4) {}</script>
</div>

then content of <script> will be escaped. But content remains unescaped if <script> is not surrounded with html:

<script>if (5 > 4) {}</script>

If here we just set pre: true then content of <script> within html will not be escaped as expected. Is it a bug or a feature, and how can I force marked.js to not escape content of <script> within html?

Activity

  1. timoxley commented on Nov 10, 2013

    @timoxley

    👍

  2. pixelkritzel commented on Aug 9, 2015

    @pixelkritzel

    +1

    I'm using marked as part of an styleguide generator and need to embed script tags in HTML. Is there an option to deactivate this kind of behaviour?

  3. pixelkritzel commented on Aug 9, 2015

    @pixelkritzel

    And hopefully I found a solution for my case. I have to see, if there will be some unforseen consequences. But I set the pedantic option to true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions