Render section content as Markdown

Closes #7
This commit is contained in:
Rafael Bardini 2020-11-01 15:03:16 +01:00
parent d8346b424a
commit 0f102e0bc0
12 changed files with 6593 additions and 17 deletions

View File

@ -1,6 +1,7 @@
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
const Handlebars = require('handlebars') const Handlebars = require('handlebars')
const micromark = require('micromark')
const extname = '.hbs' const extname = '.hbs'
const partialsDir = path.join(__dirname, 'partials') const partialsDir = path.join(__dirname, 'partials')
@ -30,6 +31,8 @@ Handlebars.registerHelper('join', (arr, separator) =>
arr.join(typeof separator === 'string' ? separator : ', '), arr.join(typeof separator === 'string' ? separator : ', '),
) )
Handlebars.registerHelper('markdown', doc => micromark(doc))
exports.render = resume => { exports.render = resume => {
const template = fs.readFileSync(path.join(__dirname, 'resume.hbs'), 'utf-8') const template = fs.readFileSync(path.join(__dirname, 'resume.hbs'), 'utf-8')
const css = fs.readFileSync(path.join(__dirname, 'style.css'), 'utf-8') const css = fs.readFileSync(path.join(__dirname, 'style.css'), 'utf-8')

6580
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,8 @@
"test": "tap" "test": "tap"
}, },
"dependencies": { "dependencies": {
"handlebars": "^4.7.6" "handlebars": "^4.7.6",
"micromark": "^2.10.1"
}, },
"devDependencies": { "devDependencies": {
"eslint": "7.12.0", "eslint": "7.12.0",

View File

@ -1,8 +1,8 @@
{{#summary}} {{#summary}}
<section id="about"> <section id="about">
<h3>About</h3> <h3>About</h3>
<div> <article>
<p>{{.}}</p> {{{markdown .}}}
</div> </article>
</section> </section>
{{/summary}} {{/summary}}

View File

@ -20,7 +20,7 @@
</div> </div>
</header> </header>
{{#summary}} {{#summary}}
<p>{{.}}</p> {{{markdown .}}}
{{/summary}} {{/summary}}
</article> </article>
{{/each}} {{/each}}

View File

@ -22,7 +22,7 @@
</div> </div>
</header> </header>
{{#studyType}} {{#studyType}}
<p>{{.}}</p> {{{markdown .}}}
{{/studyType}} {{/studyType}}
{{#if courses.length}} {{#if courses.length}}
<h5>Courses</h5> <h5>Courses</h5>

View File

@ -27,7 +27,7 @@
</div> </div>
</header> </header>
{{#description}} {{#description}}
<p>{{.}}</p> {{{markdown .}}}
{{/description}} {{/description}}
{{#if highlights.length}} {{#if highlights.length}}
<h5>Highlights</h5> <h5>Highlights</h5>

View File

@ -23,7 +23,7 @@
</div> </div>
</header> </header>
{{#summary}} {{#summary}}
<p>{{.}}</p> {{{markdown .}}}
{{/summary}} {{/summary}}
</article> </article>
{{/each}} {{/each}}

View File

@ -5,7 +5,7 @@
{{#each resume.references}} {{#each resume.references}}
{{#if reference}} {{#if reference}}
<blockquote> <blockquote>
<p>{{reference}}</p> {{{markdown reference}}}
{{#name}} {{#name}}
<p> <p>
<cite>{{.}}</cite> <cite>{{.}}</cite>

View File

@ -22,7 +22,7 @@
</div> </div>
</header> </header>
{{#summary}} {{#summary}}
<p>{{.}}</p> {{{markdown .}}}
{{/summary}} {{/summary}}
{{#if highlights.length}} {{#if highlights.length}}
<h5>Highlights</h5> <h5>Highlights</h5>

View File

@ -22,7 +22,7 @@
</div> </div>
</header> </header>
{{#summary}} {{#summary}}
<p>{{.}}</p> {{{markdown .}}}
{{/summary}} {{/summary}}
{{#if highlights.length}} {{#if highlights.length}}
<h5>Highlights</h5> <h5>Highlights</h5>

View File

@ -252,9 +252,9 @@ blockquote > * + * {
</section> </section>
<section id="about"> <section id="about">
<h3>About</h3> <h3>About</h3>
<div> <article>
<p>Richard hails from Tulsa. He has earned degrees from the University of Oklahoma and Stanford. (Go Sooners and Cardinal!) Before starting Pied Piper, he worked for Hooli as a part time software developer. While his work focuses on applied information theory, mostly optimizing lossless compression schema of both the length-limited and adaptive variants, his non-work interests range widely, everything from quantum computing to chaos theory. He could tell you about it, but THAT would NOT be a length-limited conversation!</p> <p>Richard hails from Tulsa. He has earned degrees from the University of Oklahoma and Stanford. (Go Sooners and Cardinal!) Before starting Pied Piper, he worked for Hooli as a part time software developer. While his work focuses on applied information theory, mostly optimizing lossless compression schema of both the length-limited and adaptive variants, his non-work interests range widely, everything from quantum computing to chaos theory. He could tell you about it, but THAT would NOT be a length-limited conversation!</p>
</div> </article>
</section> </section>
<section id="profiles"> <section id="profiles">
<h3>Profiles</h3> <h3>Profiles</h3>