run with default markdown parsing, fix all code examples

This commit is contained in:
Matthias Kretschmann 2020-05-25 13:15:35 +02:00
parent 43d9203e55
commit 699057fe8d
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 8 additions and 13 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
node_modules
Gemfile.lock
.jekyll-metadata
.jekyll-cache
_dist
.awspublish*
yarn.lock

View File

@ -65,14 +65,6 @@ typekitID: fih1ngo
permalink: /:title/
# Content Parsing
# --------------------
markdown: redcarpet
redcarpet:
extensions: ['no_intra_emphasis', 'autolink', 'tables', 'smart', 'hard_wrap', 'fenced_code_blocks', 'strikethrough', 'highlight', 'quote', 'footnotes', 'with_toc_data', 'space_after_headers', 'superscript', 'lax_spacing']
# Generator
# --------------------
source: ./_src

View File

@ -7,13 +7,14 @@ document.addEventListener('DOMContentLoaded', (event) => {
const successImage = '<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64"><path d="M2.12132034,39.4786797 C0.949747468,38.3071068 -0.949747468,38.3071068 -2.12132034,39.4786797 C-3.29289322,40.6502525 -3.29289322,42.5497475 -2.12132034,43.7213203 L14.2786797,60.1213203 C15.5878487,61.4304894 17.7587151,61.2529588 18.8377878,59.7484823 L60.4377878,1.74848232 C61.403448,0.402129267 61.0948354,-1.47212773 59.7484823,-2.43778785 C58.4021293,-3.40344797 56.5278723,-3.09483537 55.5622122,-1.74848232 L16.0221415,53.3795008 L2.12132034,39.4786797 Z" transform="translate(3 3)"/></svg>'
const clipboardButton = `<button class="btn btn--clipboard" title="Copy to clipboard">${clipboardImage}</button>`
const codeBlocks = document.querySelectorAll('.highlight')
const codeBlocks = document.querySelectorAll('div.highlighter-rouge')
codeBlocks.forEach(codeBlock => {
const language = codeBlock.getElementsByTagName('code')[0].dataset.lang
codeBlock.insertAdjacentHTML('afterbegin', clipboardButton)
const language = codeBlock.className.split(' ')[0].replace('language-', '')
codeBlock.insertAdjacentHTML('afterbegin', `<h6 class="highlight__title">${language}</h6>`)
const pre = codeBlock.querySelectorAll('div.highlight')[0]
pre.insertAdjacentHTML('afterbegin', clipboardButton)
})
const buttons = document.querySelectorAll('.highlight .btn--clipboard')

View File

@ -77,8 +77,9 @@ pre {
.btn--clipboard,
.success__text {
position: absolute;
top: $spacer * 1.65;
top: .1rem;
right: .1rem;
z-index: 10;
}
.success__text {