Skip to content

Commit

Permalink
🎨 return markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnath committed May 17, 2024
1 parent b1cce9d commit 2cd76eb
Show file tree
Hide file tree
Showing 12 changed files with 253 additions and 19 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

A [JSON Resume](https://jsonresume.org/) theme with styles and DevX forked from [rbardini/jsonresume-theme-even][even-theme]. This theme includes microdata and HTML changes, as well as an expanded schema structure for microdata `itemtype` on some content types, `basics.pronouns`, and `meta.sectionTitles` which allows changing the content of the resume section titles.

- 💄 Markdown support
- 🔬 Resume content included as inline microdata
- 📐 CSS grid layout
- 🌗 Light and dark modes
Expand All @@ -20,10 +21,6 @@ npm install jsonresume-theme-microdata

**note: this resume should replicate [rbardini's `even` theme][even-theme].**

### markdown support has been removed

To ease external use of the HTML templates, markdown conversions that were happening in `even` have been removed. Please pre-convert your markdown content to HTML when making your resume.json.

### microdata

This resume includes structured data in the form of microdata added as attributes throughout the HTML.
Expand Down
3 changes: 2 additions & 1 deletion components/Awards/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ShortDate } from '../utils/date.js'
import html from '../utils/html.js'
import markdown from '../utils/markdown.js'

/**
* @param {import('../../schema.js').ResumeSchema['awards']} awards
Expand All @@ -19,7 +20,7 @@ export default function Awards(awards = [], title = 'Awards') {
<dd class="meta">
${awarder && html`<div>Awarded by <strong>${awarder}</strong></div>`} ${date && ShortDate(date)}
</dd>
${summary && html`<dd>${summary}</dd>`}
${summary && html`<dd>${markdown(summary)}</dd>`}
</div>
`,
)}
Expand Down
3 changes: 2 additions & 1 deletion components/Basics/basics.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import html from '../utils/html.js'
import Link from '../utils/link.js'
import markdown from '../utils/markdown.js'
import Location from './location.js'
import Profiles from './profiles.js'

Expand All @@ -17,7 +18,7 @@ export default function Header(basics = {}) {
${label && html`<h2 itemprop="jobTitle">${label}</h2>`}
</div>
${image && html`<img src="${image}" alt="${name}'s picture" itemprop="image" />`}
${summary && html`<div itemprop="description">${summary}</div>`}
${summary && html`<div itemprop="description">${markdown(summary)}</div>`}
<div>
<address part="contact">
<dl class="icon-list">
Expand Down
9 changes: 5 additions & 4 deletions components/Education/institution.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Duration from '../utils/duration.js'
import html from '../utils/html.js'
import Link from '../utils/link.js'
import markdown from '../utils/markdown.js'

/** @typedef {NonNullable<import('../../schema.d.ts').ResumeSchema['education']>[number]} Institution */

Expand All @@ -24,17 +25,17 @@ export default function Institution(item, itemprop) {
<h4>${Link(url, institution)}</h4>
<section itemprop="owns" itemscope itemtype="https://schema.org/EducationalOccupationalProgram">
${area && html`<h5 itemprop="occupationalCategory">${area}</h5>`}
${studyType && html`<div itemprop="educationalProgramMode">${studyType}</div>`}
${studyType && html`<div itemprop="educationalProgramMode">${markdown(studyType)}</div>`}
${startDate && html`<p>${Duration(startDate, endDate)}</p>`}
${courses.length > 0 &&
html`
<ul>
${courses.map(
course =>
html`<li itemprop="hasCourse" itemscope itemtype="https://schema.org/Course">
<p itemprop="teaches">${course}</p>
<meta itemprop="name" content="${course}" />
<meta itemprop="description" content="${course}" />
<p itemprop="teaches">${markdown(course)}</p>
<meta itemprop="name" content="${markdown(course, true)}" />
<meta itemprop="description" content="${markdown(course, true)}" />
</li>`,
)}
</ul>
Expand Down
5 changes: 3 additions & 2 deletions components/Projects/project.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Duration from '../utils/duration.js'
import html from '../utils/html.js'
import Link from '../utils/link.js'
import markdown from '../utils/markdown.js'

/** @typedef {NonNullable<import('../../schema.d.ts').ResumeSchema['projects']>[number]} Project */

Expand Down Expand Up @@ -39,7 +40,7 @@ export default function Project(item, itemprop) {
<span itemprop="name">${entity}</span>
</p>`}
${type && html`<p itemprop="additionalType">${type}</p>`}
${description && html`<div class="meta" itemprop="description">${description}</div>`}
${description && html`<div class="meta" itemprop="description">${markdown(description)}</div>`}
${keywords.length > 0 &&
html`<div class="meta">
<ul itemprop="keywords" class="tag-list">
Expand All @@ -55,7 +56,7 @@ export default function Project(item, itemprop) {
${highlights.length > 0 &&
html`
<ul>
${highlights.map(highlight => html`<li itemprop="description">${highlight}</li>`)}
${highlights.map(highlight => html`<li itemprop="description">${markdown(highlight)}</li>`)}
</ul>
`}
</section>
Expand Down
3 changes: 2 additions & 1 deletion components/Publications/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ShortDate } from '../utils/date.js'
import html from '../utils/html.js'
import Link from '../utils/link.js'
import markdown from '../utils/markdown.js'

/** @typedef {NonNullable<import('../../schema.d.ts').ResumeSchema['publications']>} Publications */

Expand Down Expand Up @@ -33,7 +34,7 @@ export default function Publications(publications = [], title = 'Publications')
Published by <strong itemprop="name">${publisher}</strong>
</dd>`}
${releaseDate && html`<dd class="meta" itemprop="dateCreated">${ShortDate(releaseDate)}</dd>`}
${summary && html`<dd itemprop="abstract">${summary}</dd>`}
${summary && html`<dd itemprop="abstract">${markdown(summary)}</dd>`}
</div>
`,
)}
Expand Down
3 changes: 2 additions & 1 deletion components/References/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import html from '../utils/html.js'
import markdown from '../utils/markdown.js'

/** @typedef {NonNullable<import('../../schema.d.ts').ResumeSchema['references']>} References */

Expand All @@ -17,7 +18,7 @@ export default function References(references = [], title = 'References') {
${references.map(
({ name, reference }) => html`
<blockquote itemprop="subjectOf" itemscope itemtype="https://schema.org/Statement">
${reference && html`<div itemprop="text">${reference}</div>`}
${reference && html`<div itemprop="text">${markdown(reference)}</div>`}
${name &&
html`
<p itemprop="author" itemscope itemtype="https://schema.org/Person">
Expand Down
5 changes: 3 additions & 2 deletions components/Volunteer/volunteer-role.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Duration from '../utils/duration.js'
import html from '../utils/html.js'
import Link from '../utils/link.js'
import markdown from '../utils/markdown.js'

/** @typedef {NonNullable<import('../../schema.d.ts').ResumeSchema['volunteer']>[number]} Volunteer */
/**
Expand All @@ -17,11 +18,11 @@ export default function VolunteerRole(item, itemprop) {
<section itemprop="employee" itemscope itemtype="https://schema.org/OrganizationRole">
<h5 itemprop="roleName">${position}</h5>
${startDate && html`<p>${Duration(startDate, endDate)}</p>`}
${summary && html`<div itemprop="description">${summary}</div>`}
${summary && html`<div itemprop="description">${markdown(summary)}</div>`}
${highlights.length > 0 &&
html`
<ul>
${highlights.map(highlight => html`<li itemprop="description">${highlight}</li>`)}
${highlights.map(highlight => html`<li itemprop="description">${markdown(highlight)}</li>`)}
</ul>
`}
</section>
Expand Down
5 changes: 3 additions & 2 deletions components/Work/work-role.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Duration from '../utils/duration.js'
import html from '../utils/html.js'
import Link from '../utils/link.js'
import markdown from '../utils/markdown.js'

/** @typedef {NonNullable<import('../../schema.d.ts').ResumeSchema['work']>[number]} Work */

Expand Down Expand Up @@ -33,11 +34,11 @@ export default function WorkRole(item, itemprop) {
<div class="meta">
${startDate && html`<p>${Duration(startDate, endDate)}</p>`} ${location && html`<p>${location}</p>`}
</div>
${summary && html`<div itemprop="description">${summary}</div>`}
${summary && html`<div itemprop="description">${markdown(summary)}</div>`}
${highlights.length > 0 &&
html`
<ul>
${highlights.map(highlight => html`<li itemprop="disambiguatingDescription">${highlight}</li>`)}
${highlights.map(highlight => html`<li itemprop="disambiguatingDescription">${markdown(highlight)}</li>`)}
</ul>
`}
</section>
Expand Down
13 changes: 13 additions & 0 deletions components/utils/markdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { micromark } from 'micromark'
import striptags from 'striptags'

/**
* @param {string} doc
* @param {boolean} [stripTags]
* @returns
*/
export default function markdown(doc, stripTags = false) {
const result = micromark(doc)
const html = /** @type {string} */ (micromark(doc))
return stripTags ? striptags(html) : html
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
},
"dependencies": {
"feather-icons": "^4.29.2",
"micromark": "^4.0.0",
"striptags": "^3.2.0"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 2cd76eb

Please sign in to comment.