Skip to content

Commit

Permalink
Make code elements resizable.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gohla committed Sep 20, 2023
1 parent 3dd525d commit 0444b00
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tutorial/mdbook-diff2html/src/preprocessor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fn to_absolute_path(source_directory: &Path, source_file_path: Option<&Path>, re
fn diff_to_html(diff: &str, div_id_counter: usize) -> String {
let diff = diff.replace('$', r#"${"$"}"#);
let diff = diff.replace('`', r#"${"`"}"#);
format!(r#"<div id="diff2html_{div_id_counter}"></div>
format!(r#"<div class="diff2html" id="diff2html_{div_id_counter}"></div>
<script>
document.addEventListener('DOMContentLoaded', function () {{
Expand Down
5 changes: 4 additions & 1 deletion tutorial/src/diff2html.min.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@
border: 1px solid var(--code-border-color);
/* CHANGE: remove radius */
/*border-radius: 3px;*/
margin-bottom: 1em
margin-bottom: 1em;
/* CHANGE: make resizable */
resize: horizontal;
overflow-x: auto;
}

.d2h-file-collapse {
Expand Down
3 changes: 3 additions & 0 deletions tutorial/theme/css/general.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ code {
font-size: var(--code-font-size);
/* CHANGE: set background here, instead of it being defined on .hljs in highlight.js */
background-color: var(--code-bg);
/* CHANGE: make resizable */
resize: horizontal;
overflow-x: auto;
}

pre > code {
Expand Down
2 changes: 1 addition & 1 deletion tutorial/theme/css/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
:root {
--sidebar-width: 300px;
--page-padding: 15px;
--content-max-width: 1200px;
--content-max-width: 1000px;
--menu-bar-height: 50px;
--mono-font: "Source Code Pro", Consolas, "Ubuntu Mono", Menlo, "DejaVu Sans Mono", monospace, monospace;
--code-font-size: 0.875em /* please adjust the ace font size accordingly in editor.js */
Expand Down

0 comments on commit 0444b00

Please sign in to comment.