Upload folder using huggingface_hub
Browse files
6.11.0/atoms/package.json
CHANGED
|
@@ -8,7 +8,6 @@
|
|
| 8 |
"license": "ISC",
|
| 9 |
"dependencies": {
|
| 10 |
"@gradio/icons": "workspace:^",
|
| 11 |
-
"@gradio/markdown-code": "workspace:^",
|
| 12 |
"@gradio/utils": "workspace:^"
|
| 13 |
},
|
| 14 |
"peerDependencies": {
|
|
|
|
| 8 |
"license": "ISC",
|
| 9 |
"dependencies": {
|
| 10 |
"@gradio/icons": "workspace:^",
|
|
|
|
| 11 |
"@gradio/utils": "workspace:^"
|
| 12 |
},
|
| 13 |
"peerDependencies": {
|
6.11.0/atoms/src/BlockTitle.svelte
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
-
import
|
|
|
|
| 3 |
export let show_label = true;
|
| 4 |
export let info: string | undefined = undefined;
|
| 5 |
export let rtl = false;
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
+
import Info from "./Info.svelte";
|
| 3 |
+
|
| 4 |
export let show_label = true;
|
| 5 |
export let info: string | undefined = undefined;
|
| 6 |
export let rtl = false;
|
6.11.0/atoms/src/Info.svelte
CHANGED
|
@@ -1,22 +1,28 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
-
import {
|
| 3 |
export let info: string;
|
| 4 |
</script>
|
| 5 |
|
| 6 |
-
<div>
|
| 7 |
-
|
| 8 |
</div>
|
| 9 |
|
| 10 |
<style>
|
| 11 |
-
|
| 12 |
font-weight: var(--block-info-text-weight);
|
| 13 |
font-size: var(--block-info-text-size);
|
| 14 |
line-height: var(--line-sm);
|
| 15 |
-
}
|
| 16 |
-
div > :global(.md.prose *) {
|
| 17 |
color: var(--block-info-text-color);
|
| 18 |
-
}
|
| 19 |
-
div {
|
| 20 |
margin-bottom: var(--spacing-md);
|
| 21 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
</style>
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
+
import { render_inline_markdown } from "./inline-markdown";
|
| 3 |
export let info: string;
|
| 4 |
</script>
|
| 5 |
|
| 6 |
+
<div class="info-text">
|
| 7 |
+
{@html render_inline_markdown(info)}
|
| 8 |
</div>
|
| 9 |
|
| 10 |
<style>
|
| 11 |
+
.info-text {
|
| 12 |
font-weight: var(--block-info-text-weight);
|
| 13 |
font-size: var(--block-info-text-size);
|
| 14 |
line-height: var(--line-sm);
|
|
|
|
|
|
|
| 15 |
color: var(--block-info-text-color);
|
|
|
|
|
|
|
| 16 |
margin-bottom: var(--spacing-md);
|
| 17 |
}
|
| 18 |
+
.info-text :global(a) {
|
| 19 |
+
color: var(--link-text-color);
|
| 20 |
+
text-decoration: underline;
|
| 21 |
+
}
|
| 22 |
+
.info-text :global(code) {
|
| 23 |
+
background: var(--code-background-fill);
|
| 24 |
+
padding: 0.1em 0.3em;
|
| 25 |
+
border-radius: 3px;
|
| 26 |
+
font-size: 0.9em;
|
| 27 |
+
}
|
| 28 |
</style>
|
6.11.0/atoms/src/inline-markdown.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export const INLINE_CODE_RE = /`([^`]+)`/g;
|
| 2 |
+
export const LINK_RE = /\[([^\]]+)\]\(([^)]+)\)/g;
|
| 3 |
+
export const BOLD_ASTERISK_RE = /\*\*(.+?)\*\*/g;
|
| 4 |
+
export const BOLD_UNDERSCORE_RE = /__(.+?)__/g;
|
| 5 |
+
export const ITALIC_ASTERISK_RE = /\*(.+?)\*/g;
|
| 6 |
+
export const ITALIC_UNDERSCORE_RE = /(?<!\w)_(.+?)_(?!\w)/g;
|
| 7 |
+
export const PROTOCOL_RE = /^\w+:/;
|
| 8 |
+
|
| 9 |
+
export function escape_html(text: string): string {
|
| 10 |
+
return text
|
| 11 |
+
.replace(/&/g, "&")
|
| 12 |
+
.replace(/</g, "<")
|
| 13 |
+
.replace(/>/g, ">")
|
| 14 |
+
.replace(/"/g, """);
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
function render_link(_match: string, text: string, url: string): string {
|
| 18 |
+
const trimmed = url.trim();
|
| 19 |
+
if (PROTOCOL_RE.test(trimmed)) {
|
| 20 |
+
if (/^https?:/i.test(trimmed)) {
|
| 21 |
+
return `<a href="${trimmed}" target="_blank" rel="noopener noreferrer">${text}</a>`;
|
| 22 |
+
}
|
| 23 |
+
return text;
|
| 24 |
+
}
|
| 25 |
+
return `<a href="${trimmed}" target="_blank" rel="noopener noreferrer">${text}</a>`;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
export function render_inline_markdown(text: string): string {
|
| 29 |
+
let result = escape_html(text);
|
| 30 |
+
|
| 31 |
+
result = result.replace(INLINE_CODE_RE, "<code>$1</code>");
|
| 32 |
+
result = result.replace(LINK_RE, render_link);
|
| 33 |
+
result = result.replace(BOLD_ASTERISK_RE, "<strong>$1</strong>");
|
| 34 |
+
result = result.replace(BOLD_UNDERSCORE_RE, "<strong>$1</strong>");
|
| 35 |
+
result = result.replace(ITALIC_ASTERISK_RE, "<em>$1</em>");
|
| 36 |
+
result = result.replace(ITALIC_UNDERSCORE_RE, "<em>$1</em>");
|
| 37 |
+
result = result.replace(/\n/g, "<br>");
|
| 38 |
+
|
| 39 |
+
return result;
|
| 40 |
+
}
|