Skip to content

Commit

Permalink
Merge pull request #36 from WebDevSimplified/markdown-crash-course
Browse files Browse the repository at this point in the history
Add Markdown Article
  • Loading branch information
github-actions[bot] authored Jun 19, 2023
2 parents 877643a + 6141a9d commit fef9812
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 70 deletions.
21 changes: 0 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-markdown": "^8.0.7",
"react-scroll-sync": "^0.11.0",
"rehype-raw": "^6.1.1",
"remark-gfm": "^3.0.1",
"specificity": "^0.4.1"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
87 changes: 40 additions & 47 deletions src/blogComponents/markdownEditor/MarkdownEditor.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { useState } from "react"
import ReactMarkdown from "react-markdown"
import { ScrollSync, ScrollSyncPane } from "react-scroll-sync"
import remarkGfm from "remark-gfm"
import rehypeRaw from "rehype-raw"
import "github-markdown-css/github-markdown-dark.css"
import "./markdownEditor.css"
import "./MarkdownEditor.css"

export default function MarkdownEditor({
initialValue = "",
Expand All @@ -14,56 +13,50 @@ export default function MarkdownEditor({
const [value, setValue] = useState(initialValue)
return (
<div style={{ height }}>
<ScrollSync>
<div
className={isFullWidth ? "full-width-article-element" : ""}
style={{
display: "flex",
alignItems: "stretch",
height,
marginTop: "1rem",
}}
>
<textarea
value={value}
onChange={e => setValue(e.target.value)}
style={{
resize: "none",
flexGrow: 0,
flexShrink: 0,
fontSize: "inherit",
padding: "1rem",
overflowY: "auto",
width: "50%",
borderRadius: 0,
}}
/>
<div
className={isFullWidth ? "full-width-article-element" : ""}
className="markdown-body"
style={{
display: "flex",
alignItems: "stretch",
height,
marginTop: "1rem",
border: "1px solid var(--theme-text-lighter)",
borderLeft: "none",
width: "50%",
flexGrow: 0,
flexShrink: 0,
padding: "1rem",
overflowY: "auto",
color: "var(--color-white)",
}}
>
<ScrollSyncPane>
<textarea
value={value}
onChange={e => setValue(e.target.value)}
style={{
resize: "none",
flexGrow: 0,
flexShrink: 0,
fontSize: "inherit",
padding: "1rem",
overflowY: "auto",
width: "50%",
borderRadius: 0,
}}
/>
</ScrollSyncPane>
<ScrollSyncPane>
<div
className="markdown-body"
style={{
border: "1px solid var(--theme-text-lighter)",
borderLeft: "none",
width: "50%",
flexGrow: 0,
flexShrink: 0,
padding: "1rem",
overflowY: "auto",
color: "var(--color-white)",
}}
>
<ReactMarkdown
rehypePlugins={[rehypeRaw]}
remarkPlugins={[remarkGfm]}
>
{value}
</ReactMarkdown>
</div>
</ScrollSyncPane>
<ReactMarkdown
rehypePlugins={[rehypeRaw]}
remarkPlugins={[remarkGfm]}
>
{value}
</ReactMarkdown>
</div>
</ScrollSync>
</div>
</div>
)
}
1 change: 0 additions & 1 deletion src/styles/blog.css
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ kbd {
max-width: 125ch;
padding-left: 2rem;
padding-right: 2rem;
width: 100vw;
position: absolute;
left: 0;
right: 0;
Expand Down

0 comments on commit fef9812

Please sign in to comment.