tfrere HF Staff commited on
Commit
5580f98
Β·
1 Parent(s): 554248d
app/src/content/chapters/demo/import-content.mdx CHANGED
@@ -1,164 +1,74 @@
1
  import Note from '../../../components/Note.astro';
2
- import Accordion from '../../../components/Accordion.astro';
3
 
4
- ## Import from LaTeX or Notion
5
 
6
  <Note variant="warning">
7
- ⚠️ **Experimental Features** β€” These conversion toolkits are in active development and may not work perfectly with all source documents. Results may vary depending on your content structure and complexity.
8
  </Note>
9
 
10
- Convert your existing content directly to this template using our built-in conversion toolkits. Two powerful systems transform different source formats into fully interactive web articles with all template features.
11
 
12
- ### Available Converters
13
-
14
- **LaTeX importer** β€” Transform academic LaTeX papers into interactive web articles
15
-
16
- **Notion importerX** β€” Convert Notion pages with media and components
17
-
18
- Both systems preserve your content while adding modern web features: dark mode, responsive design, optimized figures, and live references.
19
-
20
- ### LaTeX importer
21
-
22
- Perfect for academic papers, research documents, and scientific content with equations and references.
23
-
24
- #### Quick Start
25
 
26
  ```bash
27
- # Navigate to the LaTeX importer
28
  cd app/scripts/latex-importer/
29
-
30
- # Place your LaTeX files in input/
31
  cp your-paper.tex input/main.tex
32
  cp your-paper.bib input/main.bib
33
- cp -r your-figures/ input/figures/
34
-
35
- # Run the complete conversion
36
  node index.mjs
37
-
38
- # Your converted article is ready!
39
- # β†’ output/main.mdx (ready for the template)
40
- # β†’ assets/image/ (processed figures)
41
  ```
42
 
43
- #### What Gets Converted
44
-
45
- **Mathematical content:**
46
- - `\label{eq:name}` β†’ Interactive equations with `\htmlId{name}`
47
- - `\ref{eq:name}` β†’ Clickable equation links
48
- - Complex math preserved with KaTeX
49
 
50
- **References and citations:**
51
- - `\label{sec:intro}` β†’ Invisible anchors `<span id="intro">`
52
- - `\ref{sec:intro}` β†’ Working internal links
53
  - Bibliography integration
54
 
55
- **Visual elements:**
56
- - `\includegraphics{}` β†’ `<Figure>` components with zoom
57
- - `\highlight{text}` β†’ `<mark>` styling
58
- - Figure captions and numbering
59
 
60
- #### Prerequisites
 
61
 
62
- - **Pandoc** installed (`brew install pandoc`)
63
- - LaTeX source files and bibliography
64
- - Figures in supported formats (PNG, JPG, PDF)
 
 
65
 
66
- ### Notion importer
 
 
67
 
68
- Ideal for collaborative content, documentation, and pages with rich media and interactive elements.
69
 
70
- #### Quick Start
71
 
72
  ```bash
73
- # Navigate to the Notion importer
74
  cd app/scripts/notion-importer/
75
-
76
- # Install dependencies
77
  npm install
78
-
79
- # Setup environment variables
80
  cp env.example .env
81
  # Edit .env with your Notion token
82
-
83
- # Configure pages to convert
84
  # Edit input/pages.json with your page IDs
85
-
86
- # Run the complete conversion
87
  node index.mjs
88
-
89
- # Your converted content is ready!
90
- # β†’ output/*.mdx (ready for the template)
91
- # β†’ output/media/ (downloaded images and files)
92
  ```
93
 
94
- #### What Gets Converted
95
 
96
- **Media handling:**
97
- - Images, files, PDFs automatically downloaded
98
- - Smart path conversion for web accessibility
99
- - Figure components with zoom/download functionality
100
 
101
- **Interactive components:**
102
- - Callouts β†’ Astro `Note` components
103
- - Enhanced tables with styled containers
104
- - Code blocks with copy functionality
105
-
106
- **Smart formatting:**
107
- - Notion internal links β†’ relative links
108
- - Artifact cleanup and optimization
109
- - Automatic frontmatter generation
110
-
111
- #### Prerequisites
112
 
113
  - **Node.js** with ESM support
114
- - **Notion Integration**: Set up an integration in your Notion workspace
115
- - **Notion Token**: Copy the "Internal Integration Token"
116
- - **Shared Pages**: Share the specific Notion page(s) with your integration
117
-
118
- <Accordion title="Advanced conversion options">
119
-
120
- **LaTeX importer:**
121
- ```bash
122
- # Step-by-step conversion
123
- node latex-converter.mjs # LaTeX β†’ Markdown
124
- node mdx-converter.mjs # Markdown β†’ MDX
125
-
126
- # Bibliography only
127
- node index.mjs --bib-only
128
-
129
- # Clean output before conversion
130
- node index.mjs --clean
131
- ```
132
-
133
- **Notion importer:**
134
- ```bash
135
- # Full workflow with token
136
- NOTION_TOKEN=your_token node index.mjs --clean
137
-
138
- # Notion to Markdown only
139
- node index.mjs --notion-only
140
-
141
- # Markdown to MDX only
142
- node index.mjs --mdx-only
143
- ```
144
 
145
  <Note variant="info">
146
- πŸ’‘ **Hugging Face Spaces** β€” When deploying on Hugging Face Spaces, add your `NOTION_TOKEN` to the Space secrets for secure access during the build process.
147
  </Note>
148
 
149
- </Accordion>
150
-
151
  ### Docker Deployment
152
 
153
- When deploying on Hugging Face Spaces, you can enable automatic conversion during the build process:
154
-
155
- - **LaTeX**: Set `ENABLE_LATEX_CONVERSION=true`
156
- - **Notion**: Set `ENABLE_NOTION_CONVERSION=true`
157
-
158
- If these variables are configured in your Space, the build process will automatically execute the conversion, transforming your source content into the final blog post format.
159
-
160
- This allows you to maintain source files in your repository while automatically generating the MDX content for production deployment.
161
-
162
- ### Result
163
-
164
- Both conversion systems produce fully interactive articles that preserve your original content while gaining all template benefits: responsive design, interactive equations, zoomable figures, and modern web features.
 
1
  import Note from '../../../components/Note.astro';
 
2
 
3
+ ## Import from LaTeX
4
 
5
  <Note variant="warning">
6
+ ⚠️ **Experimental** β€” May not work with all LaTeX documents.
7
  </Note>
8
 
9
+ Transform LaTeX papers into interactive web articles.
10
 
11
+ ### Quick Start
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  ```bash
 
14
  cd app/scripts/latex-importer/
 
 
15
  cp your-paper.tex input/main.tex
16
  cp your-paper.bib input/main.bib
 
 
 
17
  node index.mjs
 
 
 
 
18
  ```
19
 
20
+ ### What Gets Converted
 
 
 
 
 
21
 
22
+ - `\label{eq:name}` β†’ Interactive equations
23
+ - `\ref{eq:name}` β†’ Clickable links
24
+ - `\includegraphics{}` β†’ `<Figure>` components
25
  - Bibliography integration
26
 
27
+ ### Prerequisites
 
 
 
28
 
29
+ - **Pandoc** (`brew install pandoc`)
30
+ - LaTeX source files and figures
31
 
32
+ ### Docker Deployment
33
+
34
+ Set `ENABLE_LATEX_CONVERSION=true` in your Hugging Face Space to enable automatic conversion during build.
35
+
36
+ ## Import from Notion
37
 
38
+ <Note variant="warning">
39
+ ⚠️ **Experimental** β€” May not work with all Notion pages.
40
+ </Note>
41
 
42
+ Convert Notion pages into interactive web articles.
43
 
44
+ ### Quick Start
45
 
46
  ```bash
 
47
  cd app/scripts/notion-importer/
 
 
48
  npm install
 
 
49
  cp env.example .env
50
  # Edit .env with your Notion token
 
 
51
  # Edit input/pages.json with your page IDs
 
 
52
  node index.mjs
 
 
 
 
53
  ```
54
 
55
+ ### What Gets Converted
56
 
57
+ - Images
58
+ - Callouts β†’ `<Sidenote>` components
59
+ - Enhanced tables and code blocks
60
+ - Smart link conversion
61
 
62
+ ### Prerequisites
 
 
 
 
 
 
 
 
 
 
63
 
64
  - **Node.js** with ESM support
65
+ - **Notion Integration** with token
66
+ - **Shared Pages** with your integration
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
  <Note variant="info">
69
+ πŸ’‘ **Hugging Face Spaces** β€” Add your `NOTION_TOKEN` to Space secrets for secure access.
70
  </Note>
71
 
 
 
72
  ### Docker Deployment
73
 
74
+ Set `ENABLE_NOTION_CONVERSION=true` in your Hugging Face Space to enable automatic conversion during build.