Spaces:
Running
Running
thibaud frere
commited on
Commit
·
e01b523
1
Parent(s):
af53fac
update doc
Browse files
app/src/content/article.mdx
CHANGED
|
@@ -29,6 +29,7 @@ import Markdown from "./chapters/demo/markdown.mdx";
|
|
| 29 |
import Components from "./chapters/demo/components.mdx";
|
| 30 |
import Greetings from "./chapters/demo/greetings.mdx";
|
| 31 |
import VibeCodingCharts from "./chapters/demo/vibe-coding-charts.mdx";
|
|
|
|
| 32 |
|
| 33 |
<Introduction />
|
| 34 |
|
|
@@ -42,6 +43,8 @@ import VibeCodingCharts from "./chapters/demo/vibe-coding-charts.mdx";
|
|
| 42 |
|
| 43 |
<VibeCodingCharts />
|
| 44 |
|
|
|
|
|
|
|
| 45 |
<BestPractices />
|
| 46 |
|
| 47 |
<Greetings />
|
|
|
|
| 29 |
import Components from "./chapters/demo/components.mdx";
|
| 30 |
import Greetings from "./chapters/demo/greetings.mdx";
|
| 31 |
import VibeCodingCharts from "./chapters/demo/vibe-coding-charts.mdx";
|
| 32 |
+
import LatexConversion from "./chapters/demo/latex-convertion.mdx";
|
| 33 |
|
| 34 |
<Introduction />
|
| 35 |
|
|
|
|
| 43 |
|
| 44 |
<VibeCodingCharts />
|
| 45 |
|
| 46 |
+
<LatexConversion />
|
| 47 |
+
|
| 48 |
<BestPractices />
|
| 49 |
|
| 50 |
<Greetings />
|
app/src/content/chapters/demo/best-pratices.mdx
CHANGED
|
@@ -6,7 +6,9 @@ import HtmlEmbed from '../../../components/HtmlEmbed.astro';
|
|
| 6 |
import Sidenote from '../../../components/Sidenote.astro';
|
| 7 |
|
| 8 |
|
| 9 |
-
##
|
|
|
|
|
|
|
| 10 |
|
| 11 |
### Short sections
|
| 12 |
Break content into **small, purpose‑driven sections**. Each section should answer a **single question** or support one idea. This improves **scanability**, helps readers navigate with the TOC, and makes later edits safer.
|
|
|
|
| 6 |
import Sidenote from '../../../components/Sidenote.astro';
|
| 7 |
|
| 8 |
|
| 9 |
+
## Writing Tips
|
| 10 |
+
|
| 11 |
+
Simple guidelines to make your research writing clear, engaging, and effective. Focus on what matters most: helping readers understand your ideas quickly and completely.
|
| 12 |
|
| 13 |
### Short sections
|
| 14 |
Break content into **small, purpose‑driven sections**. Each section should answer a **single question** or support one idea. This improves **scanability**, helps readers navigate with the TOC, and makes later edits safer.
|
app/src/content/chapters/demo/introduction.mdx
CHANGED
|
@@ -14,7 +14,7 @@ Grounded in up to date good practices in web dev, it favors **interactive explan
|
|
| 14 |
<span className="tag">Markdown-based</span>
|
| 15 |
<span className="tag">KaTeX math</span>
|
| 16 |
<span className="tag">Syntax highlighting</span>
|
| 17 |
-
<span className="tag">
|
| 18 |
<span className="tag">Footnotes</span>
|
| 19 |
<span className="tag">Table of contents</span>
|
| 20 |
<span className="tag">Mermaid diagrams</span>
|
|
@@ -30,6 +30,8 @@ Grounded in up to date good practices in web dev, it favors **interactive explan
|
|
| 30 |
<span className="tag">Automatic PDF export</span>
|
| 31 |
<span className="tag">Dark theme</span>
|
| 32 |
<span className="tag">Mobile friendly</span>
|
|
|
|
|
|
|
| 33 |
</div>
|
| 34 |
|
| 35 |
<Sidenote>
|
|
|
|
| 14 |
<span className="tag">Markdown-based</span>
|
| 15 |
<span className="tag">KaTeX math</span>
|
| 16 |
<span className="tag">Syntax highlighting</span>
|
| 17 |
+
<span className="tag">Academic citations</span>
|
| 18 |
<span className="tag">Footnotes</span>
|
| 19 |
<span className="tag">Table of contents</span>
|
| 20 |
<span className="tag">Mermaid diagrams</span>
|
|
|
|
| 30 |
<span className="tag">Automatic PDF export</span>
|
| 31 |
<span className="tag">Dark theme</span>
|
| 32 |
<span className="tag">Mobile friendly</span>
|
| 33 |
+
<span className="tag">Latex import</span>
|
| 34 |
+
<span className="tag">Template update system</span>
|
| 35 |
</div>
|
| 36 |
|
| 37 |
<Sidenote>
|
app/src/content/chapters/demo/latex-convertion.mdx
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Note from '../../../components/Note.astro';
|
| 2 |
+
import Accordion from '../../../components/Accordion.astro';
|
| 3 |
+
|
| 4 |
+
## From LaTeX to Web
|
| 5 |
+
|
| 6 |
+
<Note variant="warning">
|
| 7 |
+
⚠️ **Highly Experimental Feature** — This LaTeX conversion toolkit is in active development and may not work perfectly with all LaTeX documents. Results may vary depending on your document structure and complexity.
|
| 8 |
+
</Note>
|
| 9 |
+
|
| 10 |
+
Convert your existing LaTeX papers directly to this template using the built-in LaTeX to MDX toolkit. This powerful system transforms academic LaTeX documents into fully interactive web articles with all template features.
|
| 11 |
+
|
| 12 |
+
### How it works
|
| 13 |
+
|
| 14 |
+
The conversion pipeline transforms your LaTeX source into template-ready MDX:
|
| 15 |
+
|
| 16 |
+
<Note>
|
| 17 |
+
**Smart Conversion** — The system preserves scientific formatting while adding interactivity: equations become clickable, figures get zoom functionality, and references become live links.
|
| 18 |
+
</Note>
|
| 19 |
+
|
| 20 |
+
```bash
|
| 21 |
+
# Navigate to the conversion toolkit
|
| 22 |
+
cd app/scripts/latex-to-mdx/
|
| 23 |
+
|
| 24 |
+
# Place your LaTeX files in input/
|
| 25 |
+
cp your-paper.tex input/main.tex
|
| 26 |
+
cp your-paper.bib input/main.bib
|
| 27 |
+
cp -r your-figures/ input/figures/
|
| 28 |
+
|
| 29 |
+
# Run the complete conversion
|
| 30 |
+
node index.mjs
|
| 31 |
+
|
| 32 |
+
# Your converted article is ready!
|
| 33 |
+
# → output/main.mdx (ready for the template)
|
| 34 |
+
# → assets/image/ (processed figures)
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
### What gets converted
|
| 38 |
+
|
| 39 |
+
The system intelligently transforms LaTeX elements into template components:
|
| 40 |
+
|
| 41 |
+
**Mathematical content:**
|
| 42 |
+
- `\label{eq:name}` → Interactive equations with `\htmlId{name}`
|
| 43 |
+
- `\ref{eq:name}` → Clickable equation links
|
| 44 |
+
- Complex math preserved with KaTeX
|
| 45 |
+
|
| 46 |
+
**References and citations:**
|
| 47 |
+
- `\label{sec:intro}` → Invisible anchors `<span id="intro">`
|
| 48 |
+
- `\ref{sec:intro}` → Working internal links
|
| 49 |
+
- Bibliography integration
|
| 50 |
+
|
| 51 |
+
**Visual elements:**
|
| 52 |
+
- `\includegraphics{}` → `<Figure>` components with zoom
|
| 53 |
+
- `\highlight{text}` → `<mark>` styling
|
| 54 |
+
- Figure captions and numbering
|
| 55 |
+
|
| 56 |
+
**Structure:**
|
| 57 |
+
- Sections → Proper heading hierarchy
|
| 58 |
+
- Custom LaTeX commands → Clean markdown
|
| 59 |
+
- Code snippets → Syntax-highlighted blocks
|
| 60 |
+
|
| 61 |
+
### Example transformation
|
| 62 |
+
|
| 63 |
+
**LaTeX input:**
|
| 64 |
+
```latex
|
| 65 |
+
\section{Introduction}\label{sec:intro}
|
| 66 |
+
|
| 67 |
+
The main equation is:
|
| 68 |
+
\begin{equation}\label{eq:main}
|
| 69 |
+
E = mc^2
|
| 70 |
+
\end{equation}
|
| 71 |
+
|
| 72 |
+
As shown in equation \ref{eq:main}...
|
| 73 |
+
|
| 74 |
+
\includegraphics{figure1.png}
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
**Generated MDX:**
|
| 78 |
+
```mdx
|
| 79 |
+
## Introduction
|
| 80 |
+
<span id="intro" style="position: absolute;"></span>
|
| 81 |
+
|
| 82 |
+
The main equation is:
|
| 83 |
+
$$\htmlId{main}{E = mc^2}$$
|
| 84 |
+
|
| 85 |
+
As shown in [equation](#main)...
|
| 86 |
+
|
| 87 |
+
<Figure src={figure1} alt="Figure 1" />
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
### Prerequisites
|
| 91 |
+
|
| 92 |
+
- **Pandoc** installed (`brew install pandoc`)
|
| 93 |
+
- LaTeX source files and bibliography
|
| 94 |
+
- Figures in supported formats (PNG, JPG, PDF)
|
| 95 |
+
|
| 96 |
+
<Accordion title="Advanced conversion options">
|
| 97 |
+
```bash
|
| 98 |
+
# Conversion pipeline steps
|
| 99 |
+
node latex-converter.mjs # LaTeX → Markdown
|
| 100 |
+
node mdx-converter.mjs # Markdown → MDX
|
| 101 |
+
|
| 102 |
+
# Bibliography only
|
| 103 |
+
node index.mjs --bib-only
|
| 104 |
+
|
| 105 |
+
# Clean output before conversion
|
| 106 |
+
node index.mjs --clean
|
| 107 |
+
|
| 108 |
+
# Custom input/output paths
|
| 109 |
+
node index.mjs --input=paper.tex --output=../content/
|
| 110 |
+
```
|
| 111 |
+
</Accordion>
|
| 112 |
+
|
| 113 |
+
The result is a fully interactive article that preserves your scientific content while gaining all template benefits: responsive design, interactive equations, zoomable figures, and modern web features.
|
| 114 |
+
|
| 115 |
+
### Docker deployment with LaTeX conversion
|
| 116 |
+
|
| 117 |
+
When deploying on Hugging Face Spaces, you can enable automatic LaTeX conversion during the build process by setting the `ENABLE_LATEX_CONVERSION=true` environment variable.
|
| 118 |
+
|
| 119 |
+
If this variable is configured in your Space, the build process will automatically execute the LaTeX to MDX conversion, transforming your LaTeX sources into the final blog post format.
|
| 120 |
+
|
| 121 |
+
This allows you to maintain LaTeX sources in your repository while automatically generating the MDX content for production deployment.
|
app/src/content/chapters/demo/writing-your-content.mdx
CHANGED
|
@@ -170,122 +170,3 @@ window.ColorPalettes.refresh();
|
|
| 170 |
```
|
| 171 |
</Accordion>
|
| 172 |
|
| 173 |
-
|
| 174 |
-
### LaTeX to Template Conversion
|
| 175 |
-
|
| 176 |
-
<Note variant="warning">
|
| 177 |
-
⚠️ **Highly Experimental Feature** — This LaTeX conversion toolkit is in active development and may not work perfectly with all LaTeX documents. Results may vary depending on your document structure and complexity.
|
| 178 |
-
</Note>
|
| 179 |
-
|
| 180 |
-
Convert your existing LaTeX papers directly to this template using the built-in LaTeX to MDX toolkit. This powerful system transforms academic LaTeX documents into fully interactive web articles with all template features.
|
| 181 |
-
|
| 182 |
-
#### How it works
|
| 183 |
-
|
| 184 |
-
The conversion pipeline transforms your LaTeX source into template-ready MDX:
|
| 185 |
-
|
| 186 |
-
<Note>
|
| 187 |
-
**Smart Conversion** — The system preserves scientific formatting while adding interactivity: equations become clickable, figures get zoom functionality, and references become live links.
|
| 188 |
-
</Note>
|
| 189 |
-
|
| 190 |
-
```bash
|
| 191 |
-
# Navigate to the conversion toolkit
|
| 192 |
-
cd app/scripts/latex-to-mdx/
|
| 193 |
-
|
| 194 |
-
# Place your LaTeX files in input/
|
| 195 |
-
cp your-paper.tex input/main.tex
|
| 196 |
-
cp your-paper.bib input/main.bib
|
| 197 |
-
cp -r your-figures/ input/figures/
|
| 198 |
-
|
| 199 |
-
# Run the complete conversion
|
| 200 |
-
node index.mjs
|
| 201 |
-
|
| 202 |
-
# Your converted article is ready!
|
| 203 |
-
# → output/main.mdx (ready for the template)
|
| 204 |
-
# → assets/image/ (processed figures)
|
| 205 |
-
```
|
| 206 |
-
|
| 207 |
-
#### What gets converted
|
| 208 |
-
|
| 209 |
-
The system intelligently transforms LaTeX elements into template components:
|
| 210 |
-
|
| 211 |
-
**Mathematical content:**
|
| 212 |
-
- `\label{eq:name}` → Interactive equations with `\htmlId{name}`
|
| 213 |
-
- `\ref{eq:name}` → Clickable equation links
|
| 214 |
-
- Complex math preserved with KaTeX
|
| 215 |
-
|
| 216 |
-
**References and citations:**
|
| 217 |
-
- `\label{sec:intro}` → Invisible anchors `<span id="intro">`
|
| 218 |
-
- `\ref{sec:intro}` → Working internal links
|
| 219 |
-
- Bibliography integration
|
| 220 |
-
|
| 221 |
-
**Visual elements:**
|
| 222 |
-
- `\includegraphics{}` → `<Figure>` components with zoom
|
| 223 |
-
- `\highlight{text}` → `<mark>` styling
|
| 224 |
-
- Figure captions and numbering
|
| 225 |
-
|
| 226 |
-
**Structure:**
|
| 227 |
-
- Sections → Proper heading hierarchy
|
| 228 |
-
- Custom LaTeX commands → Clean markdown
|
| 229 |
-
- Code snippets → Syntax-highlighted blocks
|
| 230 |
-
|
| 231 |
-
#### Example transformation
|
| 232 |
-
|
| 233 |
-
**LaTeX input:**
|
| 234 |
-
```latex
|
| 235 |
-
\section{Introduction}\label{sec:intro}
|
| 236 |
-
|
| 237 |
-
The main equation is:
|
| 238 |
-
\begin{equation}\label{eq:main}
|
| 239 |
-
E = mc^2
|
| 240 |
-
\end{equation}
|
| 241 |
-
|
| 242 |
-
As shown in equation \ref{eq:main}...
|
| 243 |
-
|
| 244 |
-
\includegraphics{figure1.png}
|
| 245 |
-
```
|
| 246 |
-
|
| 247 |
-
**Generated MDX:**
|
| 248 |
-
```mdx
|
| 249 |
-
## Introduction
|
| 250 |
-
<span id="intro" style="position: absolute;"></span>
|
| 251 |
-
|
| 252 |
-
The main equation is:
|
| 253 |
-
$$\htmlId{main}{E = mc^2}$$
|
| 254 |
-
|
| 255 |
-
As shown in [equation](#main)...
|
| 256 |
-
|
| 257 |
-
<Figure src={figure1} alt="Figure 1" />
|
| 258 |
-
```
|
| 259 |
-
|
| 260 |
-
#### Prerequisites
|
| 261 |
-
|
| 262 |
-
- **Pandoc** installed (`brew install pandoc`)
|
| 263 |
-
- LaTeX source files and bibliography
|
| 264 |
-
- Figures in supported formats (PNG, JPG, PDF)
|
| 265 |
-
|
| 266 |
-
<Accordion title="Advanced conversion options">
|
| 267 |
-
```bash
|
| 268 |
-
# Conversion pipeline steps
|
| 269 |
-
node latex-converter.mjs # LaTeX → Markdown
|
| 270 |
-
node mdx-converter.mjs # Markdown → MDX
|
| 271 |
-
|
| 272 |
-
# Bibliography only
|
| 273 |
-
node index.mjs --bib-only
|
| 274 |
-
|
| 275 |
-
# Clean output before conversion
|
| 276 |
-
node index.mjs --clean
|
| 277 |
-
|
| 278 |
-
# Custom input/output paths
|
| 279 |
-
node index.mjs --input=paper.tex --output=../content/
|
| 280 |
-
```
|
| 281 |
-
</Accordion>
|
| 282 |
-
|
| 283 |
-
The result is a fully interactive article that preserves your scientific content while gaining all template benefits: responsive design, interactive equations, zoomable figures, and modern web features.
|
| 284 |
-
|
| 285 |
-
#### Docker deployment with LaTeX conversion
|
| 286 |
-
|
| 287 |
-
When deploying on Hugging Face Spaces, you can enable automatic LaTeX conversion during the build process by setting the `ENABLE_LATEX_CONVERSION=true` environment variable.
|
| 288 |
-
|
| 289 |
-
If this variable is configured in your Space, the build process will automatically execute the LaTeX to MDX conversion, transforming your LaTeX sources into the final blog post format.
|
| 290 |
-
|
| 291 |
-
This allows you to maintain LaTeX sources in your repository while automatically generating the MDX content for production deployment.
|
|
|
|
| 170 |
```
|
| 171 |
</Accordion>
|
| 172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|