Skip to content

Commit

Permalink
refactor(guides): improve code formatting and readability in Gradio a…
Browse files Browse the repository at this point in the history
…nd Streamlit initialization guides

- Removed leading whitespace from git clone commands for consistency.
- Updated Python code snippets to use array join for better formatting.
- Enhanced bash command display with code blocks for improved readability.
  • Loading branch information
youngbeom-shin committed Dec 24, 2024
1 parent 4b89fdd commit 3cfd792
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
}
const httpsCloneCodeMarkdown = computed(() => {
const httpsCloneCode = ` git clone ${props.httpCloneUrl}`
const httpsCloneCode = `git clone ${props.httpCloneUrl}`
return getMarkdownCode(httpsCloneCode, 'bash')
})
Expand All @@ -98,29 +98,44 @@
})
const sshCloneCodeMarkdown = computed(() => {
const sshCloneCode = ` git clone ${props.sshCloneUrl}`
const sshCloneCode = `git clone ${props.sshCloneUrl}`
return getMarkdownCode(sshCloneCode, 'bash')
})
const appPyCode = `import gradio as gr
def greet(name):
return "Hello " + name + "!!"
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()`
const appPyCode = [
'import gradio as gr',
'',
'def greet(name):',
' return "Hello " + name + "!!"',
'',
'iface = gr.Interface(fn=greet, inputs="text", outputs="text")',
'iface.launch()'
].join('\n')
const appPyCodeMarkdown = computed(() => {
return getMarkdownCode(appPyCode, 'python', true)
return [
'',
'```python',
appPyCode,
'```',
''
].join('\n')
})
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'
].join('\n')
const pushCodeMarkdown = computed(() => {
return getMarkdownCode(pushCode, 'bash', true) +
'{data-clipboard-text="git add app.py && git commit -m \'Add application file\' && git push"}'
return [
'',
'```bash',
pushCode,
'```',
''
].join('\n')
})
const toggleActiveTab = (event) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
}
const httpsCloneCodeMarkdown = computed(() => {
const httpsCloneCode = ` git clone ${props.httpCloneUrl}`
const httpsCloneCode = `git clone ${props.httpCloneUrl}`
return getMarkdownCode(httpsCloneCode, 'bash')
})
Expand All @@ -104,26 +104,41 @@
})
const sshCloneCodeMarkdown = computed(() => {
const sshCloneCode = ` git clone ${props.sshCloneUrl}`
const sshCloneCode = `git clone ${props.sshCloneUrl}`
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)'
].join('\n')
const appPyCodeMarkdown = computed(() => {
return getMarkdownCode(appPyCode, 'python', true)
return [
'',
'```python',
appPyCode,
'```',
''
].join('\n')
})
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'
].join('\n')
const pushCodeMarkdown = computed(() => {
return getMarkdownCode(pushCode, 'bash', true) +
'{data-clipboard-text="git add app.py && git commit -m \'Add application file\' && git push"}'
return [
'',
'```bash',
pushCode,
'```',
''
].join('\n')
})
const toggleActiveTab = (event) => {
Expand Down

0 comments on commit 3cfd792

Please sign in to comment.