Update render.js script; expose it as bin when used as npm dependency.
This commit is contained in:
Ludwig Schubert
2017-10-09 14:45:00 -07:00
parent 90dca7580f
commit ffb5eaf3f7
11 changed files with 412 additions and 981 deletions
+1 -241
View File
@@ -1,246 +1,6 @@
import { Template } from '../mixins/template';
import { Controller } from '../controller';
export const style =`
d-article {
contain: content;
border-top: 1px solid rgba(0, 0, 0, 0.1);
padding-top: 2rem;
color: rgba(0, 0, 0, 0.8);
}
d-article > * {
grid-column: text;
}
@media(min-width: 768px) {
d-article {
font-size: 16px;
}
}
@media(min-width: 1024px) {
d-article {
font-size: 1rem;
line-height: 1.7em;
}
}
/* H2 */
d-article .marker {
text-decoration: none;
border: none;
counter-reset: section;
grid-column: kicker;
line-height: 1.7em;
}
d-article .marker:hover {
border: none;
}
d-article .marker span {
padding: 0 3px 4px;
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
position: relative;
top: 4px;
}
d-article .marker:hover span {
color: rgba(0, 0, 0, 0.7);
border-bottom: 1px solid rgba(0, 0, 0, 0.7);
}
d-article h2 {
grid-column-end: page-end;
font-weight: 700;
font-size: 24px;
line-height: 1.25em;
margin: 0 0 1rem 0;
}
@media(min-width: 1024px) {
d-article h2 {
font-size: 24px;
}
}
/* H3 */
d-article h3 {
font-weight: 700;
font-size: 18px;
line-height: 1.4em;
margin-bottom: 24px;
margin-top: 0;
}
@media(min-width: 1024px) {
d-article h3 {
font-size: 20px;
}
}
/* H4 */
d-article h4 {
font-weight: 600;
text-transform: uppercase;
font-size: 14px;
line-height: 1.4em;
}
d-article a {
color: inherit;
}
d-article p,
d-article ul,
d-article ol {
font-family: georgia, serif;
margin-top: 0;
margin-bottom: 1.7em;
-webkit-font-smoothing: antialiased;
}
d-article a {
border-bottom: 1px solid rgba(0, 0, 0, 0.4);
text-decoration: none;
}
d-article a:hover {
border-bottom: 1px solid rgba(0, 0, 0, 0.8);
}
d-article .link {
text-decoration: underline;
cursor: pointer;
}
d-article ul,
d-article ol {
padding-left: 24px;
}
d-article li {
margin-bottom: 24px;
margin-left: 0;
padding-left: 0;
}
d-article pre {
font-size: 14px;
margin-bottom: 20px;
}
d-article hr {
border: none;
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
margin-top: 60px;
margin-bottom: 60px;
}
d-article section {
margin-top: 60px;
margin-bottom: 60px;
}
/* Figure */
d-article figure {
position: relative;
margin-bottom: 36px;
}
d-article figure img {
width: 100%;
}
d-article figure svg text,
d-article figure svg tspan {
}
d-article figure figcaption {
color: rgba(0, 0, 0, 0.6);
font-size: 12px;
line-height: 1.5em;
}
@media(min-width: 1024px) {
d-article figure figcaption {
font-size: 13px;
}
}
d-article figure.external img {
background: white;
border: 1px solid rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);
padding: 18px;
box-sizing: border-box;
}
d-article figure figcaption a {
color: rgba(0, 0, 0, 0.6);
}
d-article span.equation-mimic {
font-family: georgia;
font-size: 115%;
font-style: italic;
}
d-article figure figcaption b {
font-weight: 600;
color: rgba(0, 0, 0, 1.0);
}
d-article > d-code,
d-article section > d-code {
display: block;
}
d-article > d-math[block],
d-article section > d-math[block] {
display: block;
}
d-article .citation {
color: #668;
cursor: pointer;
}
d-include {
width: auto;
display: block;
}
d-figure {
contain: content;
overflow: hidden;
height: 300px;
}
/* KaTeX */
.katex, .katex-prerendered {
contain: content;
display: inline-block;
}
`;
// export function addInferableTags(dom, frontMatter) {
// const title = frontMatter.title;
// if (title) {
// const titleTag = document.querySelector()
//
// }
// }
import style from '../styles/d-article.css';
const isOnlyWhitespace = /^\s*$/;
+1 -46
View File
@@ -1,49 +1,4 @@
export const style = `
d-byline {
border-top: 1px solid rgba(0, 0, 0, 0.1);
contain: content;
font-size: 0.7rem;
line-height: 1.8em;
padding: 1.5rem 0;
}
d-byline .byline {
grid-template-columns: repeat(4, 1fr);
grid-column: text;
}
d-byline h3 {
font-size: 0.55rem;
font-weight: 400;
color: rgba(0, 0, 0, 0.5);
margin: 0;
text-transform: uppercase;
}
d-byline p {
margin: 0;
}
d-byline a,
d-article d-byline a {
color: rgba(0, 0, 0, 0.8);
text-decoration: none;
border-bottom: none;
}
d-article d-byline a:hover {
text-decoration: underline;
border-bottom: none;
}
d-byline .authors p {
font-weight: 600;
}
d-byline .affiliations {
}
`;
import style from '../styles/d-byline.css';
export function bylineTemplate(frontMatter) {
return `
+1 -1
View File
@@ -6,7 +6,7 @@ export function parseFrontmatter(element) {
const content = scriptTag.textContent;
return JSON.parse(content);
} else {
console.error('Distill only supoprts JSON frontmatter tags anymore; no more YAML.');
console.error('Distill only supports JSON frontmatter tags anymore; no more YAML.');
}
} else {
console.error('You added a frontmatter tag but did not provide a script tag with front matter data in it. Please take a look at our templates.');