@reactwright/template-essay 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +117 -0
- package/package.json +43 -0
- package/src/index.ts +3 -0
- package/src/template.tsx +220 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Reactwright contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# @reactwright/template-essay
|
|
2
|
+
|
|
3
|
+
MLA-style academic essay template for the Reactwright document engine.
|
|
4
|
+
US Letter, 1" margins, Times New Roman 12pt double-spaced, first-line
|
|
5
|
+
indented paragraphs, left-aligned bold section headings, hanging-
|
|
6
|
+
indent Works Cited at the back.
|
|
7
|
+
|
|
8
|
+
## When to use this over alternatives
|
|
9
|
+
|
|
10
|
+
- Pick `@reactwright/template-essay` for single MLA-style essays,
|
|
11
|
+
undergraduate papers, term papers, or any short academic prose
|
|
12
|
+
destined for double-spaced grading-friendly output.
|
|
13
|
+
- Pick `@reactwright/template-report` for technical or business
|
|
14
|
+
reports (single-spaced, decimal section numbering).
|
|
15
|
+
- Pick `@reactwright/template-ieee` or
|
|
16
|
+
`@reactwright/template-ieee-report` for IEEE-branded papers.
|
|
17
|
+
- Pick `@reactwright/template-book` for long-form chaptered prose
|
|
18
|
+
at trade-paperback dimensions.
|
|
19
|
+
|
|
20
|
+
## Format conventions
|
|
21
|
+
|
|
22
|
+
- US Letter paper, 1" margins all sides.
|
|
23
|
+
- Body: Times New Roman 12pt, line-height 2.0 (double-spaced).
|
|
24
|
+
- Paragraphs: 0.5" first-line indent. The first paragraph after a
|
|
25
|
+
heading is flush left (no indent).
|
|
26
|
+
- Title: 14pt bold centered.
|
|
27
|
+
- Author: 12pt italic centered below the title.
|
|
28
|
+
- Section headings (depth 1): 12pt bold, left-aligned, no numeric
|
|
29
|
+
prefix. Headings are kept with the following paragraph (no orphan
|
|
30
|
+
heads at the bottom of a page).
|
|
31
|
+
- Block quotes: 0.5" left + right indent, upright (no italic), no
|
|
32
|
+
first-line indent.
|
|
33
|
+
- Inline code: monospace, no background or border.
|
|
34
|
+
- Works Cited (`role="bibliography"`): heading centered bold; entries
|
|
35
|
+
with hanging indent (0.5" left margin negated by a -0.5" first-line
|
|
36
|
+
indent) and no numeric prefix.
|
|
37
|
+
- Running header on page 2+: author's last name and page number, top
|
|
38
|
+
right.
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import "reactwright/jsx";
|
|
44
|
+
import { Template } from "@reactwright/template-essay";
|
|
45
|
+
|
|
46
|
+
export { Template };
|
|
47
|
+
|
|
48
|
+
export default function MyEssay() {
|
|
49
|
+
return (
|
|
50
|
+
<document title="The Question of Method" author="A. Author">
|
|
51
|
+
<set running="author-lastname" value="Author" />
|
|
52
|
+
|
|
53
|
+
<section title="Introduction">
|
|
54
|
+
<p>
|
|
55
|
+
Open with the thesis. Subsequent paragraphs in the same
|
|
56
|
+
section pick up the 0.5" first-line indent automatically.
|
|
57
|
+
</p>
|
|
58
|
+
<p>The second paragraph indents; the first does not.</p>
|
|
59
|
+
</section>
|
|
60
|
+
|
|
61
|
+
<section title="A Closer Look">
|
|
62
|
+
<p>
|
|
63
|
+
Cite as you go <cite cite="smith2024" />. Sources resolve
|
|
64
|
+
against the <code>refs</code> block at the back of the
|
|
65
|
+
document.
|
|
66
|
+
</p>
|
|
67
|
+
|
|
68
|
+
<quote>
|
|
69
|
+
<p>
|
|
70
|
+
Block quotes are indented on both sides and lose the
|
|
71
|
+
first-line indent. Use them for long extract quotations.
|
|
72
|
+
</p>
|
|
73
|
+
</quote>
|
|
74
|
+
</section>
|
|
75
|
+
|
|
76
|
+
<section title="Conclusion">
|
|
77
|
+
<p>Wrap with a concluding paragraph.</p>
|
|
78
|
+
</section>
|
|
79
|
+
|
|
80
|
+
<refs>
|
|
81
|
+
<ref-entry refKey="smith2024">
|
|
82
|
+
Smith, A. (2024). <em>A Robust Method</em>. Publisher.
|
|
83
|
+
</ref-entry>
|
|
84
|
+
</refs>
|
|
85
|
+
</document>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The `<set running="author-lastname" value="Author" />` line is what
|
|
91
|
+
populates the top-right page-2+ header. Omit it if you do not need a
|
|
92
|
+
running header.
|
|
93
|
+
|
|
94
|
+
## Implementation notes
|
|
95
|
+
|
|
96
|
+
Styling is expressed entirely via the styling dialect (`<styles>` +
|
|
97
|
+
`<rule>`). The exported `ESSAY_STYLES` is the CSS-dialect source the
|
|
98
|
+
template binds. There is no engine-bypass CSS.
|
|
99
|
+
|
|
100
|
+
Section roles are not required — the template numbers nothing and
|
|
101
|
+
expects unrouted top-level `<section>`s for the body. The
|
|
102
|
+
`role="bibliography"` section is composed by the userland
|
|
103
|
+
`<Bibliography>` helper that the template includes after the body
|
|
104
|
+
slot; author-side, you provide entries via `<refs>` and the engine
|
|
105
|
+
collects them.
|
|
106
|
+
|
|
107
|
+
## Limitations
|
|
108
|
+
|
|
109
|
+
- **MLA header block** (author, instructor, course, date stacked at
|
|
110
|
+
the top of page 1) is not built into the template. Authors who need
|
|
111
|
+
it can add a small lead-in section before the first body section,
|
|
112
|
+
or extend the template by adding a region above the body slot.
|
|
113
|
+
- **Single citation style.** Cites render as bare links to the Works
|
|
114
|
+
Cited target by default; MLA parenthetical "(Author 12)" formatting
|
|
115
|
+
is not currently computed by the engine. Authors who need it can
|
|
116
|
+
hand-author the parenthetical in prose and let `<cite>` provide
|
|
117
|
+
only the anchor.
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@reactwright/template-essay",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MLA-style academic essay template for the Reactwright document engine.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Reactwright contributors",
|
|
7
|
+
"homepage": "https://github.com/PurpleReverie/reactwright/tree/main/packages/template-essay#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/PurpleReverie/reactwright.git",
|
|
11
|
+
"directory": "packages/template-essay"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/PurpleReverie/reactwright/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": ["reactwright", "template", "essay", "academic", "mla"],
|
|
17
|
+
"type": "module",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./src/index.ts",
|
|
21
|
+
"default": "./src/index.ts"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"src",
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"README.md"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"check": "tsc --noEmit"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"reactwright": "workspace:*",
|
|
34
|
+
"react": "^18 || ^19"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^22.15.18",
|
|
38
|
+
"@types/react": "^19.1.2",
|
|
39
|
+
"react": "^19.1.0",
|
|
40
|
+
"reactwright": "workspace:*",
|
|
41
|
+
"typescript": "^5.8.3"
|
|
42
|
+
}
|
|
43
|
+
}
|
package/src/index.ts
ADDED
package/src/template.tsx
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import "reactwright/jsx";
|
|
2
|
+
import { Bibliography } from "../../reactwright/src/userland/Bibliography.js";
|
|
3
|
+
|
|
4
|
+
// MLA-style academic essay template, packaged as a reusable module.
|
|
5
|
+
// Templates that want the same essay styling can:
|
|
6
|
+
//
|
|
7
|
+
// import { Template, ESSAY_STYLES } from "./essay";
|
|
8
|
+
//
|
|
9
|
+
// Rules captured:
|
|
10
|
+
// • US Letter paper, 1" margins all around
|
|
11
|
+
// • Body: Times New Roman 12pt, line-height 2.0 (double-spaced)
|
|
12
|
+
// • Paragraphs: 0.5em first-line indent
|
|
13
|
+
// • Title: 14pt bold centered; Author: italic centered below
|
|
14
|
+
// • Section headings: 12pt bold, left-aligned, NO numbering
|
|
15
|
+
// • Block quotes: indented 0.5", upright (no italic)
|
|
16
|
+
// • Running header on page 2+: lastname + page number, right-aligned
|
|
17
|
+
// • Works Cited: hanging indent, no numeric prefix
|
|
18
|
+
//
|
|
19
|
+
// Slice-1+ dialect only. customCss is empty.
|
|
20
|
+
|
|
21
|
+
export const ESSAY_STYLES = `
|
|
22
|
+
.essay-title {
|
|
23
|
+
font-size: 14pt;
|
|
24
|
+
font-weight: bold;
|
|
25
|
+
font-family: 'Times New Roman', Times, serif;
|
|
26
|
+
text-align: center;
|
|
27
|
+
margin: 0 0 4pt 0;
|
|
28
|
+
line-height: 1.2;
|
|
29
|
+
text-indent: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.essay-author {
|
|
33
|
+
font-size: 12pt;
|
|
34
|
+
font-style: italic;
|
|
35
|
+
font-weight: normal;
|
|
36
|
+
text-align: center;
|
|
37
|
+
margin: 0 0 12pt 0;
|
|
38
|
+
text-indent: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.essay-section-head {
|
|
42
|
+
font-size: 12pt;
|
|
43
|
+
font-weight: bold;
|
|
44
|
+
font-family: 'Times New Roman', Times, serif;
|
|
45
|
+
text-align: left;
|
|
46
|
+
text-transform: none;
|
|
47
|
+
letter-spacing: 0;
|
|
48
|
+
margin: 12pt 0 0 0;
|
|
49
|
+
text-indent: 0;
|
|
50
|
+
break: after(avoid);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.essay-body-p {
|
|
54
|
+
margin: 0;
|
|
55
|
+
text-indent: 0.5in;
|
|
56
|
+
text-align: left;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.essay-heading-adjacent-p {
|
|
60
|
+
text-indent: 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.essay-blockquote {
|
|
64
|
+
margin: 6pt 0.5in;
|
|
65
|
+
font-style: normal;
|
|
66
|
+
text-indent: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.essay-blockquote-p {
|
|
70
|
+
margin: 0;
|
|
71
|
+
text-indent: 0;
|
|
72
|
+
text-align: left;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.essay-bibliography {
|
|
76
|
+
font-size: 12pt;
|
|
77
|
+
margin-top: 18pt;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.essay-bib-heading {
|
|
81
|
+
font-size: 12pt;
|
|
82
|
+
font-weight: bold;
|
|
83
|
+
font-style: normal;
|
|
84
|
+
text-align: center;
|
|
85
|
+
margin: 0 0 6pt 0;
|
|
86
|
+
text-indent: 0;
|
|
87
|
+
break: after(avoid);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.essay-bib-list {
|
|
91
|
+
list-style: none;
|
|
92
|
+
padding-left: 0;
|
|
93
|
+
margin: 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.essay-bib-entry {
|
|
97
|
+
margin-bottom: 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.essay-bib-entry-p {
|
|
101
|
+
margin: 0;
|
|
102
|
+
text-align: left;
|
|
103
|
+
text-indent: -0.5in;
|
|
104
|
+
padding-left: 0.5in;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.essay-cite {
|
|
108
|
+
color: inherit;
|
|
109
|
+
text-decoration: none;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.essay-code-inline {
|
|
113
|
+
background: none;
|
|
114
|
+
padding: 0;
|
|
115
|
+
border-radius: 0;
|
|
116
|
+
font-family: 'SFMono-Regular', Consolas, Menlo, monospace;
|
|
117
|
+
font-size: 0.92em;
|
|
118
|
+
}
|
|
119
|
+
`;
|
|
120
|
+
|
|
121
|
+
export function Template() {
|
|
122
|
+
return (
|
|
123
|
+
<page
|
|
124
|
+
page={{
|
|
125
|
+
size: "letter",
|
|
126
|
+
marginTop: "1in",
|
|
127
|
+
marginBottom: "1in",
|
|
128
|
+
marginLeft: "1in",
|
|
129
|
+
marginRight: "1in"
|
|
130
|
+
}}
|
|
131
|
+
typography={{
|
|
132
|
+
fontFamily: "'Times New Roman', Times, serif",
|
|
133
|
+
fontSize: "12pt",
|
|
134
|
+
lineHeight: 2.0,
|
|
135
|
+
textAlign: "left"
|
|
136
|
+
}}
|
|
137
|
+
>
|
|
138
|
+
<styles>{ESSAY_STYLES}</styles>
|
|
139
|
+
|
|
140
|
+
<rule match={{ kind: "title" }} className="essay-title" />
|
|
141
|
+
<rule match={{ kind: "author" }} className="essay-author" />
|
|
142
|
+
<rule match={{ kind: "code" }} className="essay-code-inline" />
|
|
143
|
+
|
|
144
|
+
{/* Section headings — depth 1 only, exclude bibliography heading */}
|
|
145
|
+
<rule
|
|
146
|
+
match={{
|
|
147
|
+
kind: "section-heading",
|
|
148
|
+
depth: 1,
|
|
149
|
+
not: { within: { kind: "section", role: "bibliography" } }
|
|
150
|
+
}}
|
|
151
|
+
className="essay-section-head"
|
|
152
|
+
/>
|
|
153
|
+
|
|
154
|
+
{/* Body paragraphs everywhere except blockquote + bibliography */}
|
|
155
|
+
<rule
|
|
156
|
+
match={{
|
|
157
|
+
kind: "paragraph",
|
|
158
|
+
not: {
|
|
159
|
+
or: [
|
|
160
|
+
{ within: { kind: "section", role: "bibliography" } },
|
|
161
|
+
{ within: { kind: "blockquote" } }
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
}}
|
|
165
|
+
className="essay-body-p"
|
|
166
|
+
/>
|
|
167
|
+
|
|
168
|
+
{/* First paragraph after a heading is flush left (no indent) */}
|
|
169
|
+
<rule
|
|
170
|
+
match={{ kind: "paragraph", follows: { kind: "section-heading" } }}
|
|
171
|
+
className="essay-heading-adjacent-p"
|
|
172
|
+
/>
|
|
173
|
+
|
|
174
|
+
{/* Block quotes — left/right indented, no italic, no first-line indent */}
|
|
175
|
+
<rule match={{ kind: "blockquote" }} className="essay-blockquote" />
|
|
176
|
+
<rule
|
|
177
|
+
match={{ kind: "paragraph", within: { kind: "blockquote" } }}
|
|
178
|
+
className="essay-blockquote-p"
|
|
179
|
+
/>
|
|
180
|
+
|
|
181
|
+
{/* Cites: plain author-style — no [N] bracket; rely on the bib
|
|
182
|
+
target ID instead. The default engine cite suffix is a [N]
|
|
183
|
+
counter via target-counter, which we override here with
|
|
184
|
+
empty prefix/suffix so author may insert their own. */}
|
|
185
|
+
<rule match={{ kind: "cite" }} className="essay-cite" />
|
|
186
|
+
|
|
187
|
+
{/* Works Cited (userland Bibliography emits a section role="bibliography"). */}
|
|
188
|
+
<rule match={{ kind: "section", role: "bibliography" }} className="essay-bibliography" />
|
|
189
|
+
<rule
|
|
190
|
+
match={{ kind: "section-heading", within: { kind: "section", role: "bibliography" } }}
|
|
191
|
+
className="essay-bib-heading"
|
|
192
|
+
/>
|
|
193
|
+
<rule
|
|
194
|
+
match={{ kind: "list", within: { kind: "section", role: "bibliography" } }}
|
|
195
|
+
className="essay-bib-list"
|
|
196
|
+
/>
|
|
197
|
+
<rule
|
|
198
|
+
match={{ kind: "item", within: { kind: "section", role: "bibliography" } }}
|
|
199
|
+
className="essay-bib-entry"
|
|
200
|
+
/>
|
|
201
|
+
<rule
|
|
202
|
+
match={{ kind: "paragraph", within: { kind: "section", role: "bibliography" } }}
|
|
203
|
+
className="essay-bib-entry-p"
|
|
204
|
+
/>
|
|
205
|
+
|
|
206
|
+
<header anchor="top-right" when="not-first-page" typography={{ fontSize: "12pt" }}>
|
|
207
|
+
<running name="author-lastname" /> <page-number />
|
|
208
|
+
</header>
|
|
209
|
+
|
|
210
|
+
<stack gap="0">
|
|
211
|
+
<region>
|
|
212
|
+
<slot name="title" />
|
|
213
|
+
<slot name="author" />
|
|
214
|
+
<slot name="body" />
|
|
215
|
+
<Bibliography title="Works Cited" />
|
|
216
|
+
</region>
|
|
217
|
+
</stack>
|
|
218
|
+
</page>
|
|
219
|
+
);
|
|
220
|
+
}
|