-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from mismathh/issue-9
Add initial support for Markdown
- Loading branch information
Showing
7 changed files
with
71 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
This is a Heading 2 markdown test file 1 | ||
|
||
|
||
First Heading 2 ## Testing out | ||
-- | ||
A TIL—Today I Learned—is the most liberating form of content I know of. | ||
|
||
Did you just learn how to do something? Write about that. | ||
|
||
Call it a TIL—that way you’re not promising anyone a revelation or an in-depth tutorial. You’re saying “I just figured this out: here are my notes, you may find them useful too”. | ||
|
||
I also like the humility of this kind of content. Part of the reason I publish them is to emphasize that even with 25 years of professional experience you should still celebrate learning even the most basic of things. | ||
|
||
Second Heading 2 | ||
----------------------------------------- | ||
I learned the “interact” command in pdb the other day! [Here’s my TIL](https://til.simonwillison.net/python/pdb-interact). | ||
|
||
I started publishing TILs [in April 2020](https://simonwillison.net/2020/Apr/20/self-rewriting-readme/). I’m up to 346 now, and most of them took less than 10 minutes to write. It’s such a great format for quick and satisfying online writing. | ||
|
||
My collection lives at https://til.simonwillison.net/—which publishes content from my [simonw/til](https://github.com/simonw/til) GitHub repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
markdown-to-html test | ||
|
||
|
||
A tool to convert [TIL](https://simonwillison.net/2022/Nov/6/what-to-blog-about/) posts written in [Markdown](https://www.markdownguide.org/) into **static HTML pages**. | ||
|
||
## Usage for Flags - Heading 2 | ||
Run **til-to-html -h** for additional help. | ||
|
||
Run **til-to-html -v** for version information. | ||
|
||
## Usage for Paths - Heading 2 | ||
Run **til-to-html ./examples/til.txt** to generate a single webpage. | ||
|
||
Run **til-to-html ./examples/dir** to generate multiple webpages from a folder. | ||
|
||
Refer to the [til-to-html repository](https://github.com/paulkim26/til-to-html) for additional information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export default function parseHeadingTwo(text: string) { | ||
let html = text; | ||
|
||
const headingTwoPattern = /^( {0,3}##\s+.*)/; | ||
html = html.replace(headingTwoPattern, (match, headingTwoText) => { | ||
const headingTwo = headingTwoText.split(/##/).slice(1).join("##").trim(); | ||
return `<h2>${headingTwo}</h2>`; | ||
}); | ||
|
||
const headingTwoPattern2 = /^(.*\n {0,3}-+\s*)/; | ||
html = html.replace(headingTwoPattern2, (match, headingTwoText) => { | ||
const headingTwo = headingTwoText.split(/\n/)[0].trim(); | ||
return `<h2>${headingTwo}</h2>`; | ||
}); | ||
|
||
return html; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters