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

Do not convert > into > in code blocks #625

Closed
mercmobily opened this issue Jul 16, 2015 · 2 comments
Closed

Do not convert > into > in code blocks #625

mercmobily opened this issue Jul 16, 2015 · 2 comments

Comments

@mercmobily
Copy link

Hi,

At the moment, in a code block, if you have:

def foo
  { :foo => "bar" }
end

It gets turned into:

def foo
  { :foo => "bar" }
end

Regardless of what sanitize is.

In #160 (comment) @scottgonzalez suggested:

// Let marked do its normal token generation.
tokens = marked.lexer( content );

// Mark all code blocks as already being escaped.
// This prevents the parser from encoding anything inside code blocks
tokens.forEach(function( token ) {
    if ( token.type === "code" ) {
        token.escaped = true;
    }
});

// Let marked do its normal parsing, but without encoding the code blocks
parsed = marked.parser( tokens );

Is there a case were <code> blocks should actually be escaped like that, really?

Shouldn't this be the default behaviour, without hacking?
Sorry I would have reopened #160 but couldn't.

Merc.

@mercmobily
Copy link
Author

Please let us know. There is an open PR for this too... #636

@joshbruce
Copy link
Member

#983

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants