Skip to content

Commit

Permalink
refactor(guide): optimize code display and copy behavior
Browse files Browse the repository at this point in the history
Remove leading whitespace, update code formatting for better readability, and implement clipboard text for single-line git commands while preserving multi-line display
  • Loading branch information
youngbeom-shin committed Dec 19, 2024
1 parent 276000f commit 1627e32
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 26 deletions.
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

0 comments on commit 1627e32

Please sign in to comment.