Spaces:
Sleeping
Sleeping
Update static/file-convert.html
Browse files- static/file-convert.html +3 -12
static/file-convert.html
CHANGED
|
@@ -154,14 +154,10 @@
|
|
| 154 |
<pre v-if="selectedLanguage === 'python'">
|
| 155 |
import requests
|
| 156 |
import json
|
| 157 |
-
from markdown import markdown
|
| 158 |
-
|
| 159 |
-
markdown_content = "# Hello, World!\nThis is a sample markdown."
|
| 160 |
-
html_content = markdown(markdown_content)
|
| 161 |
|
| 162 |
url = "{{ selectedApi === 'pdf' ? 'https://pvanand-web-scraping.hf.space/html_to_pdf' : 'https://pvanand-web-scraping.hf.space/convert' }}"
|
| 163 |
payload = json.dumps({
|
| 164 |
-
"{{ selectedApi === 'pdf' ? 'html_content' : 'html' }}":
|
| 165 |
})
|
| 166 |
headers = {
|
| 167 |
'Content-Type': 'application/json'
|
|
@@ -176,23 +172,18 @@ with open('output.{{ selectedApi }}', 'wb') as f:
|
|
| 176 |
<pre v-if="selectedLanguage === 'curl'">
|
| 177 |
curl -X POST '{{ selectedApi === 'pdf' ? 'https://pvanand-web-scraping.hf.space/html_to_pdf' : 'https://pvanand-web-scraping.hf.space/convert' }}' \
|
| 178 |
-H 'Content-Type: application/json' \
|
| 179 |
-
-d '{"{{ selectedApi === 'pdf' ? 'html_content' : 'html' }}": "<h1>Hello, World!</h1>
|
| 180 |
--output output.{{ selectedApi }}
|
| 181 |
</pre>
|
| 182 |
|
| 183 |
<pre v-if="selectedLanguage === 'javascript'">
|
| 184 |
-
const marked = require('marked');
|
| 185 |
-
|
| 186 |
-
const markdownContent = "# Hello, World!\nThis is a sample markdown.";
|
| 187 |
-
const htmlContent = marked(markdownContent);
|
| 188 |
-
|
| 189 |
fetch('{{ selectedApi === 'pdf' ? 'https://pvanand-web-scraping.hf.space/html_to_pdf' : 'https://pvanand-web-scraping.hf.space/convert' }}', {
|
| 190 |
method: 'POST',
|
| 191 |
headers: {
|
| 192 |
'Content-Type': 'application/json',
|
| 193 |
},
|
| 194 |
body: JSON.stringify({
|
| 195 |
-
{{ selectedApi === 'pdf' ? 'html_content' : 'html' }}:
|
| 196 |
}),
|
| 197 |
})
|
| 198 |
.then(response => response.blob())
|
|
|
|
| 154 |
<pre v-if="selectedLanguage === 'python'">
|
| 155 |
import requests
|
| 156 |
import json
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
|
| 158 |
url = "{{ selectedApi === 'pdf' ? 'https://pvanand-web-scraping.hf.space/html_to_pdf' : 'https://pvanand-web-scraping.hf.space/convert' }}"
|
| 159 |
payload = json.dumps({
|
| 160 |
+
"{{ selectedApi === 'pdf' ? 'html_content' : 'html' }}": "<h1>Hello, World!</h1>"
|
| 161 |
})
|
| 162 |
headers = {
|
| 163 |
'Content-Type': 'application/json'
|
|
|
|
| 172 |
<pre v-if="selectedLanguage === 'curl'">
|
| 173 |
curl -X POST '{{ selectedApi === 'pdf' ? 'https://pvanand-web-scraping.hf.space/html_to_pdf' : 'https://pvanand-web-scraping.hf.space/convert' }}' \
|
| 174 |
-H 'Content-Type: application/json' \
|
| 175 |
+
-d '{"{{ selectedApi === 'pdf' ? 'html_content' : 'html' }}": "<h1>Hello, World!</h1>"}' \
|
| 176 |
--output output.{{ selectedApi }}
|
| 177 |
</pre>
|
| 178 |
|
| 179 |
<pre v-if="selectedLanguage === 'javascript'">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
fetch('{{ selectedApi === 'pdf' ? 'https://pvanand-web-scraping.hf.space/html_to_pdf' : 'https://pvanand-web-scraping.hf.space/convert' }}', {
|
| 181 |
method: 'POST',
|
| 182 |
headers: {
|
| 183 |
'Content-Type': 'application/json',
|
| 184 |
},
|
| 185 |
body: JSON.stringify({
|
| 186 |
+
{{ selectedApi === 'pdf' ? 'html_content' : 'html' }}: '<h1>Hello, World!</h1>'
|
| 187 |
}),
|
| 188 |
})
|
| 189 |
.then(response => response.blob())
|