Skip to content

Commit 163732b

Browse files
committed
WIP...
1 parent c67e130 commit 163732b

File tree

23 files changed

+222
-57
lines changed

23 files changed

+222
-57
lines changed

_posts/hello-world.md renamed to _posts/gsoc_fin.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: 'Learn How to Pre-render Pages Using Static Generation with Next.js'
33
excerpt: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Praesent elementum facilisis leo vel fringilla est ullamcorper eget. At imperdiet dui accumsan sit amet nulla facilities morbi tempus.'
4-
coverImage: '/assets/blog/hello-world/cover.jpg'
5-
date: '2020-03-16T05:35:07.322Z'
4+
coverImage: 'http://localhost:3000/website/assets/blog/gsoc_fin/cover.png'
5+
date: '2023-08-12T15:21:32.163Z'
66
author:
77
name: Ratnabali Dutta
88
picture: '/assets/blog/authors/myAvatar.png'
99
ogImage:
10-
url: '/assets/blog/hello-world/cover.jpg'
10+
url: 'http://localhost:3000/website/assets/blog/gsoc_fin/cover.png'
1111
---
1212

1313
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Praesent elementum facilisis leo vel fringilla est ullamcorper eget. At imperdiet dui accumsan sit amet nulla facilities morbi tempus. Praesent elementum facilisis leo vel fringilla. Congue mauris rhoncus aenean vel. Egestas sed tempus urna et pharetra pharetra massa massa ultricies.

_posts/latex_1.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: 'About LaTeX, Modes, and Mathtext'
3+
excerpt: 'This blog is a textual reference to help document what I learned about LaTeX and the mechanics of its implementation.'
4+
coverImage: 'http://localhost:3000/website/assets/blog/latex_1/cover.png'
5+
date: '2023-08-12T15:21:32.163Z'
6+
author:
7+
name: devrd
8+
picture: '/assets/blog/authors/myAvatar.png'
9+
ogImage:
10+
url: 'http://localhost:3000/website/assets/blog/latex_1/cover.png'
11+
---
12+
13+
## **LaTeX: Yes, the one used in _typesetting_ [Part - I]**
14+
15+
A significant usage of LaTeX is its ability to handle complex mathematical expressions and keep user-friendliness in mind, primarily combining the simplest of formulas to build a more intricate one. We will discuss how LaTeX typesets math formulas and mathematical fonts.
16+
17+
TeX can tap into 6 modes: the Vertical Mode, Internal Vertical Mode, Horizontal Mode, Restricted Horizontal Mode, Math Mode, and Display Math Mode. We will come across this along the way of discussing math
18+
19+
In math mode, (fun fact $$ is used as math brackets because typesetting math is supposedly expensive) TeX creates math lists that are composed of the following types of things:
20+
* An atom
21+
* A horizontal or a vertical material (check) (\hbox, \vadjust{kern1pt})
22+
* A glob of Glue (\hskip, \mskip)
23+
* Kern (\kern)
24+
* A style change (\displaystyle, \scriptstyle)
25+
* Generalized fraction (\above, \over)
26+
* Boundary (\left, \right)
27+
* A four-way choice (\mathchoice)
28+
29+
30+
The most important items are called atoms, and they have three parts: a nucleus, a
31+
superscript, and a subscript. In TeX, atoms can be one of 13 different types, Ord (ordinary like ‘x’), Op (large operator like summation in the figure below), Bin (binary operator ‘+’), Rel (relational operator ‘=’), Open ‘(’, Close ‘)’, Punctuation, Inner (12), Over (a), Under (a), Accented (à), Radical (√2), \Vcent (Vbox to be centered).
32+
33+
34+
#### **Boxes, dimensions, and glue**
35+
36+
<div style="display: flex;">
37+
<p>
38+
Boxes are two-dimensional rectangles with mainly 3 associated measurements, height, width, and depth. Basically, everything gets constructed nimbly by gluing these rectangles together. The TeX boxes come with a baseline which is also the reference point in aligning the characters used in the text. These dimensions vary across different fonts. Some of the symbols, however, extend beyond these measurements in special cases like using an italic font or a big operator. We can also use black boxes (◼) in TeX which are used to create horizontal or vertical lines, notably known as ‘\hrule’ or ‘\vrule’.
39+
40+
</p>
41+
<img src="http://localhost:3000/website/assets/blog/latex_1/baseline.png" width="250" height="250"/>
42+
</div>
43+
44+
<div style="display: flex;">
45+
<img src="http://localhost:3000/website/assets/blog/latex_1/baseline_eg.png" width="300" height="250"/>
46+
<p>
47+
------ Placeholder text:------The TeX boxes come with a baseline which is also the reference point in aligning the characters used in the text. These dimensions vary across different fonts. Some of the symbols, however, extend beyond these measurements in special cases like using an italic font or a big operator. We can also use black boxes (◼) in TeX which are used to create horizontal or vertical lines, notably known as ‘\hrule’ or ‘\vrule’.
48+
</p>
49+
</div>
50+
51+
When typesetting any formula, we wrap the appropriate characters in a box derived from its font dimensions using the ‘\hbox’ command, and eventually the individual horizontal boxes are wrapped in a ‘\vbox’ command to create a vertical box. In TeX’s view, two lines of text would look like this:
52+
53+
<div style="text-align: center">
54+
<img src="http://localhost:3000/website/assets/blog/latex_1/boxes.png" width="750" height="250"/>
55+
</div>
56+
57+
Like every crafting project, TeX also uses glue to paste these boxes together. In simpler terms, words and lines are glued together to maintain cleanliness and alignment. Glue also comes with its own attributes which are construed as its own space, the ability to stretch, and the ability to shrink. To determine the thickness of the glue, TeX has its own formula to set the stretchability and shrinkability. (Commands used to set glue: \vskip, \hskip, \vfill, \hfill)

drafts/preview.md renamed to _posts/latex_2.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2-
title: 'Preview Mode for Static Generation'
2+
title: 'Learn How to Pre-render Pages Using Static Generation with Next.js'
33
excerpt: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Praesent elementum facilisis leo vel fringilla est ullamcorper eget. At imperdiet dui accumsan sit amet nulla facilities morbi tempus.'
4-
coverImage: '/assets/blog/preview/cover.jpg'
5-
date: '2020-03-16T05:35:07.322Z'
4+
coverImage: 'http://localhost:3000/website/assets/blog/latex_2/cover.png'
5+
date: '2023-08-13T15:21:32.163Z'
66
author:
7-
name: Ratnabali Dutta
7+
name: devrd
88
picture: '/assets/blog/authors/myAvatar.png'
99
ogImage:
10-
url: '/assets/blog/preview/cover.jpg'
10+
url: 'http://localhost:3000/website/assets/blog/latex_2/cover.png'
1111
---
1212

1313
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Praesent elementum facilisis leo vel fringilla est ullamcorper eget. At imperdiet dui accumsan sit amet nulla facilities morbi tempus. Praesent elementum facilisis leo vel fringilla. Congue mauris rhoncus aenean vel. Egestas sed tempus urna et pharetra pharetra massa massa ultricies.

components/hero-post.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,23 @@ const HeroPost = ({
3434
return (
3535
<>
3636
{/** Add Cover Image Hero as background **/}
37-
<div className={`${unna.className} position-relative ${styles.herocont}`}>
37+
<div className={`${unna.className} ${styles.herocont}`}>
3838
<CoverImage title={title} src={coverImage} slug={slug} />
39-
<div className={`${styles.text} position-absolute`}>
40-
<h4 className={`mb-4 text-truncate ${styles.herotitle}`}>
39+
<div className={`${styles.text}`}>
40+
<h3 className="fs-4 mb-1 text-truncate">
4141
<Link
4242
as={`/posts/${slug}`}
4343
href="/posts/[slug]"
44+
className="hover:underline"
4445
>
4546
{title}
4647
</Link>
47-
</h4>
48-
<DateFormatter dateString={date} />
49-
<p className="mt-4 mb-4 text-truncate">{excerpt}</p>
48+
</h3>
49+
<div className="text-lg mb-4">
50+
<DateFormatter dateString={date} />
51+
</div>
52+
<p className="mb-4">{excerpt}</p>
53+
<Avatar name={author.name} picture={author.picture} />
5054
</div>
5155
</div>
5256
</>

components/more-stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const MoreStories = ({ posts }: Props) => {
99
return (
1010
<section>
1111
<h2 className="mt-5 mb-3 fs-3 fw-bold">
12-
More Stories...
12+
More Posts...
1313
</h2>
1414
<div className="row">
1515
{posts.map((post) => (

components/post-body.tsx

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
11
import markdownStyles from './markdown-styles.module.css'
2+
import ReactMarkdown from 'react-markdown'
3+
import rehypeRaw from "rehype-raw";
4+
import Image from 'next/image'
25

36
type Props = {
47
content: string
58
}
69

710
const PostBody = ({ content }: Props) => {
11+
12+
console.log(content)
813
return (
9-
<div className="max-w-2xl mx-auto">
10-
<div
11-
className={markdownStyles['markdown']}
12-
dangerouslySetInnerHTML={{ __html: content }}
13-
/>
14-
</div>
14+
<ReactMarkdown
15+
children={content}
16+
rehypePlugins={[rehypeRaw]}
17+
className={markdownStyles['markdown']}
18+
escapeHtml={false}
19+
components={{
20+
img: (props) => (
21+
<Image
22+
src={props.src}
23+
alt={props.alt}
24+
width={props.width}
25+
height={props.height}
26+
className="position-relative p-3 m-1"
27+
/>
28+
),
29+
}}
30+
/>
1531
)
1632
}
1733

drafts/test.md renamed to drafts/gsoc_fin.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: 'Learn How to Pre-render Pages Using Static Generation with Next.js'
33
excerpt: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Praesent elementum facilisis leo vel fringilla est ullamcorper eget. At imperdiet dui accumsan sit amet nulla facilities morbi tempus.'
4-
coverImage: '/assets/blog/hello-world/cover.jpg'
5-
date: '2020-03-16T05:35:07.322Z'
4+
coverImage: 'http://localhost:3000/website/assets/blog/gsoc_fin/cover.png'
5+
date: '2023-08-12T15:21:32.163Z'
66
author:
77
name: Ratnabali Dutta
88
picture: '/assets/blog/authors/myAvatar.png'
99
ogImage:
10-
url: '/assets/blog/hello-world/cover.jpg'
10+
url: 'http://localhost:3000/website/assets/blog/gsoc_fin/cover.png'
1111
---
1212

1313
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Praesent elementum facilisis leo vel fringilla est ullamcorper eget. At imperdiet dui accumsan sit amet nulla facilities morbi tempus. Praesent elementum facilisis leo vel fringilla. Congue mauris rhoncus aenean vel. Egestas sed tempus urna et pharetra pharetra massa massa ultricies.

next.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ const nextConfig = {
44

55
// Add basePath
66
basePath: '/website',
7+
images: {
8+
domains: ['localhost'],
9+
},
10+
711

812
}
913

package-lock.json

Lines changed: 97 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
"next": "latest",
1414
"react": "^18.2.0",
1515
"react-dom": "^18.2.0",
16+
"react-markdown": "^8.0.7",
17+
"rehype-raw": "^6.1.1",
1618
"remark": "^14.0.2",
1719
"remark-html": "^15.0.1",
1820
"typescript": "^4.7.4"

0 commit comments

Comments
 (0)