Skip to content

Commit 858dad8

Browse files
committed
latex codeblock as code
1 parent cd40156 commit 858dad8

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed
1023 Bytes
Binary file not shown.

examples/server/webui/public/demo-conversation.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{
1212
"id": 1734087548327,
1313
"role": "assistant",
14-
"content": "This is the formula:\n$\\frac{e^{x_i}}{\\sum_{j=1}^{n}e^{x_j}}$\n\nGiven an input vector \\(\\mathbf{x} = [x_1, x_2, \\ldots, x_n]\\)\n\n\\[\ny_i = \\frac{e^{x_i}}{\\sum_{j=1}^n e^{x_j}}\n\\]\n\nCode block latex:\n```latex\n\\frac{e^{x_i}}{\\sum_{j=1}^{n}e^{x_j}}\n```\n\nTest dollar sign: $1234 $4567\n\nInvalid latex syntax: $E = mc^$ and $$E = mc^$$",
14+
"content": "This is the formula:\n\n$\\frac{e^{x_i}}{\\sum_{j=1}^{n}e^{x_j}}$\n\nGiven an input vector \\(\\mathbf{x} = [x_1, x_2, \\ldots, x_n]\\)\n\n\\[\ny_i = \\frac{e^{x_i}}{\\sum_{j=1}^n e^{x_j}}\n\\]\n\nCode block latex:\n```latex\n\\frac{e^{x_i}}{\\sum_{j=1}^{n}e^{x_j}}\n```\n\nTest dollar sign: $1234 $4567\n\nInvalid latex syntax: $E = mc^$ and $$E = mc^$$",
1515
"timings": {
1616
"prompt_n": 1,
1717
"prompt_ms": 28.923,
@@ -27,7 +27,7 @@
2727
{
2828
"id": 1734087548329,
2929
"role": "assistant",
30-
"content": "Code block js:\n```js\nconsole.log('hello world')\n```"
30+
"content": "Code block:\n```js\nconsole.log('hello world')\n```\n```sh\nls -la /dev\n```"
3131
}
3232
]
3333
}

examples/server/webui/src/highlight-config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import elixir from 'highlight.js/lib/languages/elixir';
2323
import kotlin from 'highlight.js/lib/languages/kotlin';
2424
import lua from 'highlight.js/lib/languages/lua';
2525
import php from 'highlight.js/lib/languages/php';
26+
import latex from 'highlight.js/lib/languages/latex';
2627

2728
hljs.registerLanguage('python', python);
2829
hljs.registerLanguage('javascript', javascript);
@@ -42,11 +43,13 @@ hljs.registerLanguage('elixir', elixir);
4243
hljs.registerLanguage('kotlin', kotlin);
4344
hljs.registerLanguage('lua', lua);
4445
hljs.registerLanguage('php', php);
46+
hljs.registerLanguage('latex', latex);
4547

4648
// reuse some languages to further reduce bundle size
4749

4850
hljs.registerLanguage('shell', bash);
4951
hljs.registerLanguage('bash', bash);
52+
hljs.registerLanguage('sh', bash);
5053

5154
hljs.registerLanguage('css', scss);
5255
hljs.registerLanguage('scss', scss);

examples/server/webui/src/main.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@ const VueMarkdown = defineComponent(
9191
const md = shallowRef(new MarkdownIt({
9292
breaks: true,
9393
highlight: function (str, lang) { // Add highlight.js
94-
if (lang === 'latex') {
95-
return renderLatexHTML(str, true);
96-
}
9794
if (lang && hljs.getLanguage(lang)) {
9895
try {
9996
return '<pre><code class="hljs">' +

0 commit comments

Comments
 (0)