Skip to content

Commit

Permalink
✨ Add LaTex support (#5129)
Browse files Browse the repository at this point in the history
![Screenshot 2024-06-28 at 13 06
52](https://github.com/argilla-io/argilla/assets/7398909/197a18d9-a2e7-43dc-93ff-9e66fbbbf778)

---------

Co-authored-by: nataliaElv <[email protected]>
  • Loading branch information
damianpumar and nataliaElv authored Jul 2, 2024
1 parent 22b357e commit 42f651d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { marked } from "marked";
import { markedHighlight } from "marked-highlight";
import hljs from "highlight.js";
import * as DOMPurify from "dompurify";
import markedKatex from "marked-katex-extension";
const preprocess = (html) => {
return html.replace(/[^\S\r\n]+$/gm, "");
Expand All @@ -37,6 +38,12 @@ DOMPurify.addHook("beforeSanitizeAttributes", (node) => {
}
});
marked.use(
markedKatex({
throwOnError: false,
})
);
marked.use(
{ hooks: { preprocess, postprocess } },
markedHighlight({
Expand Down
1 change: 1 addition & 0 deletions argilla-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"frontmatter-markdown-loader": "^3.7.0",
"marked": "^5.0.3",
"marked-highlight": "^2.0.1",
"marked-katex-extension": "^5.0.2",
"nuxt": "^2.15.8",
"nuxt-highlightjs": "^1.0.2",
"pinia": "^2.1.4",
Expand Down
2 changes: 1 addition & 1 deletion argilla/docs/how_to_guides/dataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ A **field** is defined in the `TextField` class that has the following arguments
* `name`: The name of the field.
* `title` (optional): The name of the field, as it will be displayed in the UI. Defaults to the `name` value.
* `required` (optional): Whether the field is required or not. Defaults to `True`. At least one field must be required.
* `use_markdown` (optional): Specify whether you want markdown rendered in the UI. Defaults to `False`. If you set it to True, you will be able to use all the Markdown features for text formatting, as well as embed multimedia content and PDFs.
* `use_markdown` (optional): Specify whether you want markdown rendered in the UI. Defaults to `False`. If you set it to True, you will be able to use all the Markdown features for text formatting, including LaTex formulas and embedding multimedia content and PDFs.

!!! note
The order of the fields in the UI follows the order in which these are added to the fields attribute in the Python SDK.
Expand Down

0 comments on commit 42f651d

Please sign in to comment.