Skip to content

Commit 6569a08

Browse files
committed
Clean up.
1 parent b980256 commit 6569a08

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ LaTeX("$$E = mc^2$$ $$E = mc^2$$")
208208
}
209209
```
210210

211-
> <img src="./assets/images/numbers.png" width="258" height="145">
211+
> <img src="./assets/images/numbers.png" width="433" height="153">
212212
213213
#### 🔗 Unencode HTML
214214

@@ -227,7 +227,7 @@ LaTeX("$x^2&lt;1$")
227227
228228
#### 🕶️ Rendering Style
229229

230-
The view has four rendering styles.
230+
The view has four rendering styles. The `wait` style is the default style, and loads the view synchronously on the main queue. To get better performance and move SVG rendering off of the main queue, use any of the other three styles.
231231

232232
| Style | Asynchronous | Description |
233233
|:-----------|:-------------|:-------------------------------------------------------------------------|
@@ -236,7 +236,6 @@ The view has four rendering styles.
236236
| `progress` | Yes | The view displays a progress view until its finished rendering. |
237237
| `wait` | No | *(default)* The view blocks the main queue until its finished rendering. |
238238

239-
The `wait` style is the default style, and loads the view synchronously on the main queue. To get better performance and move SVG rendering off of the main queue, use any of the other three styles.
240239

241240
#### 🪩 Animated
242241

@@ -270,8 +269,6 @@ LaTeX.imageCache.removeAll()
270269

271270
SVGs and images are rendered and cached on demand, but there may be situations where you want to preload the data so that there is minimal lag when the view appears.
272271

273-
SVGs and images are rendered as a result of the view's environment, so it is important to call the `preload` method last in the view's modifier chain if you use it.
274-
275272
```swift
276273
VStack {
277274
ForEach(expressions, id: \.self) { expression in
@@ -285,3 +282,5 @@ VStack {
285282
}
286283
}
287284
```
285+
286+
SVGs and images are rendered as a result of the view's environment, so it is important to call the `preload` method last in the view's modifier chain if you use it.

Sources/LaTeXSwiftUI/Models/Parser.swift

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ internal struct Parser {
3535
let regex: Regex<T>
3636
let terminatingRegex: Regex<U>
3737
let equation: Component.ComponentType
38-
let supportsRecursion: Bool
3938
}
4039

4140
// MARK: Private properties
@@ -44,36 +43,31 @@ internal struct Parser {
4443
static let inline = EquationComponent(
4544
regex: #/\$(.*?)\$/#,
4645
terminatingRegex: #/\$/#,
47-
equation: .inlineEquation,
48-
supportsRecursion: false)
46+
equation: .inlineEquation)
4947

5048
/// An TeX-style block equation component.
5149
static let tex = EquationComponent(
5250
regex: #/\$\$\s*(.*?)\s*\$\$/#,
5351
terminatingRegex: #/\$\$/#,
54-
equation: .texEquation,
55-
supportsRecursion: false)
52+
equation: .texEquation)
5653

5754
/// A block equation.
5855
static let block = EquationComponent(
5956
regex: #/\\\[\s*(.*?)\s*\\\]/#,
6057
terminatingRegex: #/\\\]/#,
61-
equation: .blockEquation,
62-
supportsRecursion: false)
58+
equation: .blockEquation)
6359

6460
/// A named equation component.
6561
static let named = EquationComponent(
6662
regex: #/\\begin{equation}\s*(.*?)\s*\\end{equation}/#,
6763
terminatingRegex: #/\\end{equation}/#,
68-
equation: .namedEquation,
69-
supportsRecursion: true)
64+
equation: .namedEquation)
7065

7166
/// A named no number equation component.
7267
static let namedNoNumber = EquationComponent(
7368
regex: #/\\begin{equation\*}\s*(.*?)\s*\\end{equation\*}/#,
7469
terminatingRegex: #/\\end{equation\*}/#,
75-
equation: .namedNoNumberEquation,
76-
supportsRecursion: true)
70+
equation: .namedNoNumberEquation)
7771

7872
// Order matters
7973
static let allEquations: [EquationComponent] = [

assets/images/numbers.png

13.8 KB
Loading

0 commit comments

Comments
 (0)