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

refactor(guide): optimize code display and copy behavior #867

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
})

const httpsCloneCodeWithTokenMarkdown = computed(() => {
const httpsCloneCodeWithToken = ` git clone https://${props.userName}:${props.userToken}@${props.httpCloneUrl.replace('https://', '')}`
const httpsCloneCodeWithToken = `git clone https://${props.userName}:${props.userToken}@${props.httpCloneUrl.replace('https://', '')}`
return getMarkdownCode(httpsCloneCodeWithToken, 'bash')
})

Expand All @@ -102,28 +102,25 @@
return getMarkdownCode(sshCloneCode, 'bash')
})

const appPyCode = `
import gradio as gr
const appPyCode = `import gradio as gr

def greet(name):
def greet(name):
return "Hello " + name + "!!"

iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()
`
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()`

const appPyCodeMarkdown = computed(() => {
return getMarkdownCode(appPyCode, 'python', true)
})

const pushCode = `
$ git add app.py
$ git commit -m "Add application file"
$ git push
`
const pushCode = `git add app.py
git commit -m "Add application file"
git push`

const pushCodeMarkdown = computed(() => {
return getMarkdownCode(pushCode, 'bash', true)
return getMarkdownCode(pushCode, 'bash', true) +
'{data-clipboard-text="git add app.py && git commit -m \'Add application file\' && git push"}'
})

const toggleActiveTab = (event) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
})

const httpsCloneCodeWithTokenMarkdown = computed(() => {
const httpsCloneCodeWithToken = ` git clone https://${props.userName}:${props.userToken}@${props.httpCloneUrl.replace('https://', '')}`
const httpsCloneCodeWithToken = `git clone https://${props.userName}:${props.userToken}@${props.httpCloneUrl.replace('https://', '')}`
return getMarkdownCode(httpsCloneCodeWithToken, 'bash')
})

Expand All @@ -108,25 +108,22 @@
return getMarkdownCode(sshCloneCode, 'bash')
})

const appPyCode = `
import streamlit as st

x = st.slider('Select a value')
st.write(x, 'squared is', x * x)
`
const appPyCode = `import streamlit as st

x = st.slider('Select a value')
st.write(x, 'squared is', x * x)`

const appPyCodeMarkdown = computed(() => {
return getMarkdownCode(appPyCode, 'python', true)
})

const pushCode = `
$ git add app.py
$ git commit -m "Add application file"
$ git push
`
const pushCode = `git add app.py
git commit -m "Add application file"
git push`

const pushCodeMarkdown = computed(() => {
return getMarkdownCode(pushCode, 'bash', true)
return getMarkdownCode(pushCode, 'bash', true) +
'{data-clipboard-text="git add app.py && git commit -m \'Add application file\' && git push"}'
})

const toggleActiveTab = (event) => {
Expand Down
Loading