Skip to content

Conversation

@stephannv
Copy link
Contributor

Remove legacy code checking Phlex version.

)
end
end
pre { raw(safe(FORMATTER.format(lexer.lex(@code)))) }
Copy link
Contributor Author

@stephannv stephannv Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if is recommended to flag code as safe by default. Our users can pass user generated content here and create a security breach. I think we should force the users to use safe when passing content, so they will know what they are doing. I can open a new PR to change this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah agreed but in this context is it not safe because we are limiting what is being passed as safe? It's only in the code component to render it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I will make some tests here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s an interesting debate. It may be cumbersome to require the user to call safe by himself on a code block. A code block component implies that the code will be interpreted. Let's keep that way for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sethhorsley @cirdes I think Rouge is escaping the code, so I think it is safe since we are using safe on rouge result and not on given code.

)
end
end
pre { raw(safe(FORMATTER.format(lexer.lex(@code)))) }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s an interesting debate. It may be cumbersome to require the user to call safe by himself on a code block. A code block component implies that the code will be interpreted. Let's keep that way for now.

@cirdes cirdes merged commit ad270a3 into ruby-ui:main Nov 8, 2024
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

Successfully merging this pull request may close these issues.

3 participants