From 06f529279b26876aaaecff2cc0322296961497e2 Mon Sep 17 00:00:00 2001 From: Jason Gao Date: Fri, 13 Oct 2023 22:48:44 +0800 Subject: [PATCH 1/2] Chapter opening title update --- magicbook/stylesheets/components/chapter-opening.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/magicbook/stylesheets/components/chapter-opening.scss b/magicbook/stylesheets/components/chapter-opening.scss index e4d89663..e7528927 100644 --- a/magicbook/stylesheets/components/chapter-opening.scss +++ b/magicbook/stylesheets/components/chapter-opening.scss @@ -18,10 +18,11 @@ } .chapter-opening-title { - margin-left: 5mm; + margin-left: 12mm; display: flex; flex-direction: column; align-items: flex-end; + justify-content: space-between; text-align: right; h1 { From d4e072b227e3fc7fa11e3b425d80ba07ad8db502 Mon Sep 17 00:00:00 2001 From: Jason Gao Date: Fri, 13 Oct 2023 22:49:37 +0800 Subject: [PATCH 2/2] fix codesplit bugs --- magicbook/plugins/codesplit.js | 10 ++++++---- magicbook/stylesheets/components/codesplit.scss | 2 +- magicbook/stylesheets/components/table.scss | 11 ++++------- magicbook/stylesheets/components/typography.scss | 6 ++++++ 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/magicbook/plugins/codesplit.js b/magicbook/plugins/codesplit.js index 54d76bcf..a1a0b171 100644 --- a/magicbook/plugins/codesplit.js +++ b/magicbook/plugins/codesplit.js @@ -94,9 +94,7 @@ Plugin.prototype = { pairs.forEach((pair) => { const code = pair.code.join('\n') + '\n'; - const comments = - pair.comment.map((str) => str.replace('//', '').trim()).join('\n') + - '\n'; + const comments = pair.comment.map((str) => str.replace('//', '').trim()); const className = pair.className.concat('pair'); // highlight the pair that has comment @@ -105,7 +103,11 @@ Plugin.prototype = { $('.pairs').append( `
${code}
-

${comments}

+ ${ + comments.length > 0 + ? `

${comments.join('\n')}

` + : '' + }
`, ); }); diff --git a/magicbook/stylesheets/components/codesplit.scss b/magicbook/stylesheets/components/codesplit.scss index e5353b61..ddd34eac 100644 --- a/magicbook/stylesheets/components/codesplit.scss +++ b/magicbook/stylesheets/components/codesplit.scss @@ -84,7 +84,7 @@ // add a margin between adjacent highlight pairs &.highlight + .pair.highlight { - margin-top: 1pt; + border-top: 1pt solid $color-gray-100; } .comment { diff --git a/magicbook/stylesheets/components/table.scss b/magicbook/stylesheets/components/table.scss index 0820e038..5487ddad 100644 --- a/magicbook/stylesheets/components/table.scss +++ b/magicbook/stylesheets/components/table.scss @@ -43,12 +43,9 @@ table { } } - // codesplit - .codesplit { - padding: 0; - - .pair { - background: $color-gray-200; - } + // block level code in table + pre { + background: $color-gray-100; + padding: 4pt 2pt; } } diff --git a/magicbook/stylesheets/components/typography.scss b/magicbook/stylesheets/components/typography.scss index fe67665a..809cffbb 100644 --- a/magicbook/stylesheets/components/typography.scss +++ b/magicbook/stylesheets/components/typography.scss @@ -50,6 +50,7 @@ strong { pre { margin: 0; + white-space: pre-wrap; } code { @@ -125,6 +126,11 @@ figure { max-width: 50%; } +.half-width-right > figure, +.half-width-left > figure { + margin-top: 0; +} + // column list .col-list { display: flex;