latex codeblock as code
This commit is contained in:
parent
cd4015643f
commit
858dad8d91
4 changed files with 5 additions and 5 deletions
Binary file not shown.
|
@ -11,7 +11,7 @@
|
||||||
{
|
{
|
||||||
"id": 1734087548327,
|
"id": 1734087548327,
|
||||||
"role": "assistant",
|
"role": "assistant",
|
||||||
"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^$$",
|
"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^$$",
|
||||||
"timings": {
|
"timings": {
|
||||||
"prompt_n": 1,
|
"prompt_n": 1,
|
||||||
"prompt_ms": 28.923,
|
"prompt_ms": 28.923,
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
{
|
{
|
||||||
"id": 1734087548329,
|
"id": 1734087548329,
|
||||||
"role": "assistant",
|
"role": "assistant",
|
||||||
"content": "Code block js:\n```js\nconsole.log('hello world')\n```"
|
"content": "Code block:\n```js\nconsole.log('hello world')\n```\n```sh\nls -la /dev\n```"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import elixir from 'highlight.js/lib/languages/elixir';
|
||||||
import kotlin from 'highlight.js/lib/languages/kotlin';
|
import kotlin from 'highlight.js/lib/languages/kotlin';
|
||||||
import lua from 'highlight.js/lib/languages/lua';
|
import lua from 'highlight.js/lib/languages/lua';
|
||||||
import php from 'highlight.js/lib/languages/php';
|
import php from 'highlight.js/lib/languages/php';
|
||||||
|
import latex from 'highlight.js/lib/languages/latex';
|
||||||
|
|
||||||
hljs.registerLanguage('python', python);
|
hljs.registerLanguage('python', python);
|
||||||
hljs.registerLanguage('javascript', javascript);
|
hljs.registerLanguage('javascript', javascript);
|
||||||
|
@ -42,11 +43,13 @@ hljs.registerLanguage('elixir', elixir);
|
||||||
hljs.registerLanguage('kotlin', kotlin);
|
hljs.registerLanguage('kotlin', kotlin);
|
||||||
hljs.registerLanguage('lua', lua);
|
hljs.registerLanguage('lua', lua);
|
||||||
hljs.registerLanguage('php', php);
|
hljs.registerLanguage('php', php);
|
||||||
|
hljs.registerLanguage('latex', latex);
|
||||||
|
|
||||||
// reuse some languages to further reduce bundle size
|
// reuse some languages to further reduce bundle size
|
||||||
|
|
||||||
hljs.registerLanguage('shell', bash);
|
hljs.registerLanguage('shell', bash);
|
||||||
hljs.registerLanguage('bash', bash);
|
hljs.registerLanguage('bash', bash);
|
||||||
|
hljs.registerLanguage('sh', bash);
|
||||||
|
|
||||||
hljs.registerLanguage('css', scss);
|
hljs.registerLanguage('css', scss);
|
||||||
hljs.registerLanguage('scss', scss);
|
hljs.registerLanguage('scss', scss);
|
||||||
|
|
|
@ -91,9 +91,6 @@ const VueMarkdown = defineComponent(
|
||||||
const md = shallowRef(new MarkdownIt({
|
const md = shallowRef(new MarkdownIt({
|
||||||
breaks: true,
|
breaks: true,
|
||||||
highlight: function (str, lang) { // Add highlight.js
|
highlight: function (str, lang) { // Add highlight.js
|
||||||
if (lang === 'latex') {
|
|
||||||
return renderLatexHTML(str, true);
|
|
||||||
}
|
|
||||||
if (lang && hljs.getLanguage(lang)) {
|
if (lang && hljs.getLanguage(lang)) {
|
||||||
try {
|
try {
|
||||||
return '<pre><code class="hljs">' +
|
return '<pre><code class="hljs">' +
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue