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

Custom element syntax #875

Open
whitphx opened this issue Apr 24, 2024 · 0 comments
Open

Custom element syntax #875

whitphx opened this issue Apr 24, 2024 · 0 comments

Comments

@whitphx
Copy link
Owner

whitphx commented Apr 24, 2024

Found that the JS-based syntax has one clear downside that developers have to take care of escaping some characters such as backtick (`) and backslash (\).
Ref:

export function escapeTextForJsTemplateLiteral(text: string): string {
return text
.replaceAll("\\", "\\\\")
.replaceAll("`", "\\`")
.replaceAll("${", "\\${");
}

Custom element syntax like below allows developers to write the Python code without such cares.

<stlite-app>
import streamlit as st

st.write("Hello World")
</stlite-app>
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

1 participant