Skip to content

Commit 8531b85

Browse files
test: add test.md verification suite to verify frontmatter, Mermaid, LaTeX, and alerts
1 parent b20e6bf commit 8531b85

1 file changed

Lines changed: 117 additions & 0 deletions

File tree

test.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
---
2+
document_type: Technical Test Suite
3+
version: 1.0.0
4+
last_updated: 2026-05-24
5+
audited_by: Antigravity Codebase Auditor Swarm
6+
status: Fixed & Verified
7+
---
8+
9+
# Markdown Viewer Verification & Test Suite
10+
11+
This document is a comprehensive test suite designed to verify that the Markdown Viewer renders all standard and custom extensions correctly in the live preview and exports cleanly to standalone HTML and PDF formats.
12+
13+
---
14+
15+
## 1. YAML Frontmatter Verification (Fixes #109)
16+
*The table below is rendered from the YAML frontmatter block at the very top of this document. It must render correctly in both the live preview pane and the exported HTML/PDF documents.*
17+
18+
- **Expected Behavior:** A styled metadata table containing headers (`document_type`, `version`, `last_updated`, `status`) must appear at the absolute top of the document.
19+
- **Verification:** Export this document to HTML and check if the metadata table is styled with borders and clean background rows.
20+
21+
---
22+
23+
## 2. Mermaid Diagram rendering (XSS & Operator Escaping Fixes)
24+
*This section tests if the Mermaid parser compiles flowcharts correctly without HTML-mangling when dealing with mathematical comparison operators like `<` or `>`.*
25+
26+
```mermaid
27+
graph TD
28+
Start([Initialize App]) --> Parse{Parse YAML Frontmatter}
29+
Parse -- Case 1: x < 5 --> RenderTable[Render Metadata Table]
30+
Parse -- Case 2: y >= 10 --> RenderMarkdown[Render GFM Body]
31+
RenderTable --> Compile[Compile Standalone HTML]
32+
RenderMarkdown --> Compile
33+
Compile --> Success((Verify Layout))
34+
```
35+
36+
- **Expected Behavior:** A flowchart displaying the rendering pipeline must compile visually in the preview panel. The comparison texts `x < 5` and `y >= 10` must display correctly without causing syntax rendering errors.
37+
- **Security Check:** Inline script elements inside Mermaid labels are strictly blocked by setting `securityLevel: 'strict'`.
38+
39+
---
40+
41+
## 3. Mathematical Formulations (LaTeX & MathJax Delimiters)
42+
*This section tests that inline and block mathematical typesetting engines compile correctly without colliding with standard inline currency symbols.*
43+
44+
### Inline Math Test
45+
The Pythagorean theorem is expressed as $a^2 + b^2 = c^2$.
46+
47+
### Block Math Test
48+
The Gaussian distribution probability density function is represented as:
49+
50+
$$f(x \mid \mu, \sigma^2) = \frac{1}{\sigma \sqrt{2\pi}} e^{-\frac{(x - \mu)^2}{2\sigma^2}}$$
51+
52+
### Currency Delimiter Collision Test
53+
*Standard currency symbols must NOT compile as LaTeX equations:*
54+
- I bought this book for $5 and that markdown guide for $10. (Should render as standard text with raw dollar signs).
55+
56+
---
57+
58+
## 4. GitHub-Style Admonitions / Alerts
59+
*This section verifies that GFM alert blocks render with matching accent colors, border highlights, and icons.*
60+
61+
> [!NOTE]
62+
> This is a standard blue note alert. It provides general background information.
63+
64+
> [!TIP]
65+
> This is a green tip alert. It highlights optimizations or recommended paths.
66+
67+
> [!IMPORTANT]
68+
> This is a purple important alert. It documents essential steps.
69+
70+
> [!WARNING]
71+
> This is a yellow warning alert. It warns of potential compatibility risks.
72+
73+
> [!CAUTION]
74+
> This is a red caution alert. It flags high-risk data-loss actions.
75+
76+
---
77+
78+
## 5. Standard GitHub-Flavored Markdown (GFM)
79+
80+
### Syntax Highlighting (highlight.js)
81+
```javascript
82+
// Verification script for startup files
83+
(async function verifyStartup() {
84+
const isDesktop = typeof Neutralino !== 'undefined';
85+
if (isDesktop && window.NL_INITIAL_FILE_CONTENT) {
86+
console.log("Startup file loaded successfully:", window.NL_INITIAL_FILE_CONTENT.name);
87+
}
88+
})();
89+
```
90+
91+
### Task Lists / Checklists
92+
- [x] Fixed startup double-click race condition
93+
- [x] Standardized modals with focus traps
94+
- [x] Enabled case-insensitive drag-and-drop matches
95+
- [ ] Implement incremental Mermaid rendering cache (Future)
96+
97+
### Tables
98+
| Component | Status | Verification Link |
99+
| :--- | :--- | :--- |
100+
| Dynamic Tabs | **Fixed** | [Tab Bar](#1-yaml-frontmatter-verification-fixes-109) |
101+
| Pane Resizer | **Fixed** | [Resizer Separator](#) |
102+
| Math Equations | **Fixed** | [LaTeX block](#3-mathematical-formulations-latex--mathjax-delimiters) |
103+
104+
---
105+
106+
## 6. Custom Markdown Extensions
107+
108+
### Footnotes
109+
Here is a simple footnote reference[^1] and a second complex one[^2].
110+
111+
[^1]: This is the first standard footnote text.
112+
[^2]: This is the second footnote containing *styled markdown* and a backlink.
113+
114+
### Subscripts, Superscripts, and Highlights
115+
- Water is H~2~O.
116+
- The Einstein equation is E=mc^2^.
117+
- Highly critical text must be ==highlighted in yellow== for scannability.

0 commit comments

Comments
 (0)