From c9d979514c009e8b28d99cff2614b92019ccd5c8 Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Tue, 11 Jun 2019 13:40:50 +0200 Subject: [PATCH] Add custom class support for mermaid and button shortcodes --- assets/_markdown.scss | 4 ++++ assets/_utils.scss | 4 ++++ exampleSite/content/docs/shortcodes.md | 4 ++-- .../scss/book.scss_48b060fe05b0a273d182ef83c0605941.content | 2 +- .../scss/book.scss_48b060fe05b0a273d182ef83c0605941.json | 2 +- layouts/shortcodes/button.html | 4 +++- layouts/shortcodes/mermaid.html | 2 +- 7 files changed, 16 insertions(+), 6 deletions(-) diff --git a/assets/_markdown.scss b/assets/_markdown.scss index 10286c4..d52dddb 100644 --- a/assets/_markdown.scss +++ b/assets/_markdown.scss @@ -28,6 +28,10 @@ $block-border-radius: 0.15rem; } } + img { + max-width: 100%; + } + code { padding: 0 $padding-4; background: $gray-100; diff --git a/assets/_utils.scss b/assets/_utils.scss index 62085d1..887a866 100644 --- a/assets/_utils.scss +++ b/assets/_utils.scss @@ -34,6 +34,10 @@ margin: 0 auto; } +.text-center { + text-align: center; +} + @mixin fixed { position: fixed; top: 0; diff --git a/exampleSite/content/docs/shortcodes.md b/exampleSite/content/docs/shortcodes.md index cf854e8..1987426 100644 --- a/exampleSite/content/docs/shortcodes.md +++ b/exampleSite/content/docs/shortcodes.md @@ -34,7 +34,7 @@ Miseratus fonte Ditis conubia. # Buttons ```tpl -{{}}Get Home{{}} +{{}}Get Home{{}} {{}}Contribute{{}} ``` @@ -134,7 +134,7 @@ Miseratus fonte Ditis conubia. {{< columns >}} ```tpl -{{}} +{{}} sequenceDiagram Alice->>Bob: Hello Bob, how are you? alt is sick diff --git a/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.content b/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.content index 5147a1a..3716275 100644 --- a/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.content +++ b/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.content @@ -1 +1 @@ -/*!normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css*/html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.markdown{line-height:1.7}.markdown h1,.markdown h2,.markdown h3,.markdown h4,.markdown h5{font-weight:400;line-height:1.25}.markdown>:first-child{margin-top:0;line-height:1}.markdown b,.markdown optgroup,.markdown strong{font-weight:bolder}.markdown a{text-decoration:none}.markdown a:hover{text-decoration:underline}.markdown code{padding:0 .25rem;background:#f8f9fa;border-radius:.15rem}.markdown pre{padding:1rem;background:#f8f9fa;border-radius:.15rem;font-size:.875rem;overflow-x:auto}.markdown pre code{padding:0;background:0 0}.markdown blockquote{border-left:2px solid #dee2e6;margin:0;padding:1px 1rem}.markdown blockquote :first-child{margin-top:0}.markdown blockquote :last-child{margin-bottom:0}.markdown table{border-spacing:0;border-collapse:collapse}.markdown table tr th,.markdown table tr td{padding:.5rem 1rem;line-height:1;border:1px solid #e9ecef}.markdown table tr:nth-child(2n){background:#f8f9fa}.markdown hr{height:1px;border:none;background:#e9ecef}.markdown-inner>:first-child{margin-top:0}.markdown-inner>:last-child{margin-bottom:0}.book-expand{border:1px solid #e9ecef;margin-top:1rem;margin-bottom:1rem}.book-expand .book-expand-head{background:#f8f9fa;padding:.5rem 1rem;cursor:pointer}.book-expand .book-expand-content{display:none;padding:1rem}.book-expand input[type=checkbox]:checked+.book-expand-content{display:block}.book-tabs{border:1px solid #e9ecef;display:flex;flex-wrap:wrap}.book-tabs label{display:inline-block;padding:.5rem 1rem;border-bottom:1px transparent;cursor:pointer}.book-tabs .book-tabs-content{order:999;width:100%;border-top:1px solid #f8f9fa;padding:1rem;display:none}.book-tabs input[type=radio]:checked+label{border-bottom:1px solid #004ed0}.book-tabs input[type=radio]:checked+label+.book-tabs-content{display:block}.book-columns>div{max-width:50%}.book-columns>div+div{margin-left:2rem}a.book-btn{display:inline-block;color:#004ed0!important;text-decoration:none!important;border:1px solid #004ed0;border-radius:.25rem;padding:.25rem 1rem;margin-top:.5rem;margin-bottom:.5rem;cursor:pointer}.flex{display:flex}.flex-auto{flex:1 1 auto}.flex-even{flex:1 1}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.align-center{align-items:center}.mx-auto{margin:0 auto}html{font-size:16px;letter-spacing:.33px;scroll-behavior:smooth}html,body{min-width:20rem;overflow-x:hidden}body{color:#343a40;background:#fff;font-family:sans-serif;font-weight:400;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}body *{box-sizing:inherit}h1,h2,h3,h4,h5{font-weight:400}a{text-decoration:none;color:#004ed0}a:visited{color:#8440f1}img{vertical-align:middle}aside nav ul{padding:0;margin:0;list-style:none}aside nav ul li{margin:1em 0}aside nav ul a{display:block}aside nav ul a:hover{opacity:.5}aside nav ul ul{padding-left:1rem}ul.pagination{display:flex;justify-content:center}ul.pagination .page-item a{padding:1rem}.container{max-width:80rem;margin:0 auto}.book-brand{margin-top:0}.book-menu{flex:0 0 16rem;font-size:.875rem}.book-menu nav{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-menu a{color:#343a40}.book-menu a.active{color:#004ed0}.book-section-flat{margin-bottom:2rem}.book-section-flat:not(:first-child){margin-top:2rem}.book-section-flat>a,.book-section-flat>span{font-weight:bolder}.book-section-flat>ul{padding-left:0}.book-page{min-width:20rem;flex-grow:1;padding:1rem}.book-header{margin-bottom:1rem;display:none}.book-toc{flex:0 0 14rem;font-size:.75rem}.book-toc nav{width:14rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-toc nav>ul>li:first-child{margin-top:0}.book-toc.level-1 ul ul,.book-toc.level-2 ul ul ul,.book-toc.level-3 ul ul ul ul,.book-toc.level-4 ul ul ul ul ul,.book-toc.level-5 ul ul ul ul ul ul,.book-toc.level-6 ul ul ul ul ul ul ul{display:none}.book-footer{display:flex;padding-top:1rem;font-size:.875rem;align-items:baseline}.book-footer img{width:1em;height:1em}.book-posts{min-width:20rem;max-width:41rem;flex-grow:1;padding:1rem}.book-posts article{padding-bottom:1rem}.book-home{padding:1rem}aside nav,.book-page,.book-posts,.markdown{transition:.2s ease-in-out;transition-property:transform,margin-left,opacity;will-change:transform,margin-left}@media screen and (max-width:55rem){.book-toc{display:none}}@media screen and (max-width:41rem){.book-menu{margin-left:-16rem}.book-header{display:flex}#menu-control:checked+main .book-menu nav,#menu-control:checked+main .book-page,#menu-control:checked+main .book-posts{transform:translateX(16rem)}#menu-control:checked+main .book-header label{transform:rotate(90deg)}#menu-control:checked+main .markdown{opacity:.25}}@media screen and (min-width:80rem){.book-page,.book-posts,.book-menu nav,.book-toc nav{padding:2rem 1rem}}@font-face{font-family:roboto;font-style:italic;font-weight:300;src:local("Roboto Light Italic"),local(Roboto-LightItalic),url(fonts/roboto-v19-latin-300italic.woff2) format("woff2"),url(fonts/roboto-v19-latin-300italic.woff) format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:400;src:local(Roboto),local(Roboto-Regular),url(fonts/roboto-v19-latin-regular.woff2) format("woff2"),url(fonts/roboto-v19-latin-regular.woff) format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:700;src:local("Roboto Bold"),local(Roboto-Bold),url(fonts/roboto-v19-latin-700.woff2) format("woff2"),url(fonts/roboto-v19-latin-700.woff) format("woff")}@font-face{font-family:roboto mono;font-style:normal;font-weight:400;src:local("Roboto Mono"),local(RobotoMono-Regular),url(fonts/roboto-mono-v6-latin-regular.woff2) format("woff2"),url(fonts/roboto-mono-v6-latin-regular.woff) format("woff")}body{font-family:roboto,sans-serif}code{font-family:roboto mono,monospace} \ No newline at end of file +/*!normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css*/html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.markdown{line-height:1.7}.markdown h1,.markdown h2,.markdown h3,.markdown h4,.markdown h5{font-weight:400;line-height:1.25}.markdown>:first-child{margin-top:0;line-height:1}.markdown b,.markdown optgroup,.markdown strong{font-weight:bolder}.markdown a{text-decoration:none}.markdown a:hover{text-decoration:underline}.markdown img{max-width:100%}.markdown code{padding:0 .25rem;background:#f8f9fa;border-radius:.15rem}.markdown pre{padding:1rem;background:#f8f9fa;border-radius:.15rem;font-size:.875rem;overflow-x:auto}.markdown pre code{padding:0;background:0 0}.markdown blockquote{border-left:2px solid #dee2e6;margin:0;padding:1px 1rem}.markdown blockquote :first-child{margin-top:0}.markdown blockquote :last-child{margin-bottom:0}.markdown table{border-spacing:0;border-collapse:collapse}.markdown table tr th,.markdown table tr td{padding:.5rem 1rem;line-height:1;border:1px solid #e9ecef}.markdown table tr:nth-child(2n){background:#f8f9fa}.markdown hr{height:1px;border:none;background:#e9ecef}.markdown-inner>:first-child{margin-top:0}.markdown-inner>:last-child{margin-bottom:0}.book-expand{border:1px solid #e9ecef;margin-top:1rem;margin-bottom:1rem}.book-expand .book-expand-head{background:#f8f9fa;padding:.5rem 1rem;cursor:pointer}.book-expand .book-expand-content{display:none;padding:1rem}.book-expand input[type=checkbox]:checked+.book-expand-content{display:block}.book-tabs{border:1px solid #e9ecef;display:flex;flex-wrap:wrap}.book-tabs label{display:inline-block;padding:.5rem 1rem;border-bottom:1px transparent;cursor:pointer}.book-tabs .book-tabs-content{order:999;width:100%;border-top:1px solid #f8f9fa;padding:1rem;display:none}.book-tabs input[type=radio]:checked+label{border-bottom:1px solid #004ed0}.book-tabs input[type=radio]:checked+label+.book-tabs-content{display:block}.book-columns>div{max-width:50%}.book-columns>div+div{margin-left:2rem}a.book-btn{display:inline-block;color:#004ed0!important;text-decoration:none!important;border:1px solid #004ed0;border-radius:.25rem;padding:.25rem 1rem;margin-top:.5rem;margin-bottom:.5rem;cursor:pointer}.flex{display:flex}.flex-auto{flex:1 1 auto}.flex-even{flex:1 1}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.align-center{align-items:center}.mx-auto{margin:0 auto}.text-center{text-align:center}html{font-size:16px;letter-spacing:.33px;scroll-behavior:smooth}html,body{min-width:20rem;overflow-x:hidden}body{color:#343a40;background:#fff;font-family:sans-serif;font-weight:400;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}body *{box-sizing:inherit}h1,h2,h3,h4,h5{font-weight:400}a{text-decoration:none;color:#004ed0}a:visited{color:#8440f1}img{vertical-align:middle}aside nav ul{padding:0;margin:0;list-style:none}aside nav ul li{margin:1em 0}aside nav ul a{display:block}aside nav ul a:hover{opacity:.5}aside nav ul ul{padding-left:1rem}ul.pagination{display:flex;justify-content:center}ul.pagination .page-item a{padding:1rem}.container{max-width:80rem;margin:0 auto}.book-brand{margin-top:0}.book-menu{flex:0 0 16rem;font-size:.875rem}.book-menu nav{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-menu a{color:#343a40}.book-menu a.active{color:#004ed0}.book-section-flat{margin-bottom:2rem}.book-section-flat:not(:first-child){margin-top:2rem}.book-section-flat>a,.book-section-flat>span{font-weight:bolder}.book-section-flat>ul{padding-left:0}.book-page{min-width:20rem;flex-grow:1;padding:1rem}.book-header{margin-bottom:1rem;display:none}.book-toc{flex:0 0 14rem;font-size:.75rem}.book-toc nav{width:14rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-toc nav>ul>li:first-child{margin-top:0}.book-toc.level-1 ul ul,.book-toc.level-2 ul ul ul,.book-toc.level-3 ul ul ul ul,.book-toc.level-4 ul ul ul ul ul,.book-toc.level-5 ul ul ul ul ul ul,.book-toc.level-6 ul ul ul ul ul ul ul{display:none}.book-footer{display:flex;padding-top:1rem;font-size:.875rem;align-items:baseline}.book-footer img{width:1em;height:1em}.book-posts{min-width:20rem;max-width:41rem;flex-grow:1;padding:1rem}.book-posts article{padding-bottom:1rem}.book-home{padding:1rem}aside nav,.book-page,.book-posts,.markdown{transition:.2s ease-in-out;transition-property:transform,margin-left,opacity;will-change:transform,margin-left}@media screen and (max-width:55rem){.book-toc{display:none}}@media screen and (max-width:41rem){.book-menu{margin-left:-16rem}.book-header{display:flex}#menu-control:checked+main .book-menu nav,#menu-control:checked+main .book-page,#menu-control:checked+main .book-posts{transform:translateX(16rem)}#menu-control:checked+main .book-header label{transform:rotate(90deg)}#menu-control:checked+main .markdown{opacity:.25}}@media screen and (min-width:80rem){.book-page,.book-posts,.book-menu nav,.book-toc nav{padding:2rem 1rem}}@font-face{font-family:roboto;font-style:italic;font-weight:300;src:local("Roboto Light Italic"),local(Roboto-LightItalic),url(fonts/roboto-v19-latin-300italic.woff2) format("woff2"),url(fonts/roboto-v19-latin-300italic.woff) format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:400;src:local(Roboto),local(Roboto-Regular),url(fonts/roboto-v19-latin-regular.woff2) format("woff2"),url(fonts/roboto-v19-latin-regular.woff) format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:700;src:local("Roboto Bold"),local(Roboto-Bold),url(fonts/roboto-v19-latin-700.woff2) format("woff2"),url(fonts/roboto-v19-latin-700.woff) format("woff")}@font-face{font-family:roboto mono;font-style:normal;font-weight:400;src:local("Roboto Mono"),local(RobotoMono-Regular),url(fonts/roboto-mono-v6-latin-regular.woff2) format("woff2"),url(fonts/roboto-mono-v6-latin-regular.woff) format("woff")}body{font-family:roboto,sans-serif}code{font-family:roboto mono,monospace} \ No newline at end of file diff --git a/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.json b/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.json index 0552a9c..571a51e 100644 --- a/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.json +++ b/exampleSite/resources/_gen/assets/scss/book.scss_48b060fe05b0a273d182ef83c0605941.json @@ -1 +1 @@ -{"Target":"book.min.40a7a4a197e0c73ece96b2afec0d34ad394563de6f97699dd68b042cd2f5ae9e.css","MediaType":"text/css","Data":{"Integrity":"sha256-QKekoZfgxz7OlrKv7A00rTlFY95vl2md1osELNL1rp4="}} \ No newline at end of file +{"Target":"book.min.1f05d81b275a862f44a849039ab95c032a03abf4aebe5aeff5367876fc7b68ab.css","MediaType":"text/css","Data":{"Integrity":"sha256-HwXYGydahi9EqEkDmrlcAyoDq/Suvlrv9TZ4dvx7aKs="}} \ No newline at end of file diff --git a/layouts/shortcodes/button.html b/layouts/shortcodes/button.html index 88b0f20..98d2cdd 100644 --- a/layouts/shortcodes/button.html +++ b/layouts/shortcodes/button.html @@ -7,4 +7,6 @@ {{ with .Get "relref" }} {{ $ref = relref $ . }} {{ end }} -{{ $.Inner }} + + {{ $.Inner }} + diff --git a/layouts/shortcodes/mermaid.html b/layouts/shortcodes/mermaid.html index 66eb4a6..f569bc4 100644 --- a/layouts/shortcodes/mermaid.html +++ b/layouts/shortcodes/mermaid.html @@ -4,6 +4,6 @@ {{ .Page.Scratch.Set "mermaid" true }} {{ end }} -

+

{{ .Inner }}