From 42780f763253b26ba5a56a8b4e34f6e84ba815be Mon Sep 17 00:00:00 2001 From: xy2z Date: Fri, 3 Apr 2020 14:02:35 +0200 Subject: [PATCH] Added new option: break_code_blocks --- README.md | 3 +++ config/config-example.yaml | 3 +++ public/css/base.css | 1 - public/index.php | 1 + src/PineDocs.php | 4 ++++ src/templates/main.html | 5 +++++ 6 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8111f65..6ee78eb 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,9 @@ Feel free to edit the `config/config.yaml` file to fit your needs. - **`no_extension_markdown`** (bool) Render files with no extension as markdown, eg `README`. Default `true`. +- **`break_code_blocks`** (bool) Break code blocks in multiple lines instead of horizontally scrolling. Default `false`. + + ## License GNU GPLv3. See LICENSE.txt diff --git a/config/config-example.yaml b/config/config-example.yaml index 99483b6..bab83ab 100644 --- a/config/config-example.yaml +++ b/config/config-example.yaml @@ -61,3 +61,6 @@ render_max_file_size: 50 # [bool] Render files with no extension as markdown, eg. `README` # no_extension_markdown: true + +# [bool] Break code blocks in multiple lines instead of horizontally scrolling +# break_code_blocks: false diff --git a/public/css/base.css b/public/css/base.css index 1e7b323..5dd6dc6 100644 --- a/public/css/base.css +++ b/public/css/base.css @@ -216,7 +216,6 @@ blockquote { #content_wrapper pre code { display: block; - white-space: pre-wrap; padding: 1em; border-radius: 2px; } diff --git a/public/index.php b/public/index.php index 44c57a4..52bb591 100644 --- a/public/index.php +++ b/public/index.php @@ -111,6 +111,7 @@ 'render_max_file_size' => PineDocs::$config->render_max_file_size, 'font_family' => PineDocs::$config->font_family, 'font_size' => PineDocs::$config->font_size, + 'break_code_blocks' => PineDocs::$config->break_code_blocks, ), 'errors' => PineDocs::$errors, ); diff --git a/src/PineDocs.php b/src/PineDocs.php index 4be850f..171556c 100644 --- a/src/PineDocs.php +++ b/src/PineDocs.php @@ -90,6 +90,10 @@ static public function load_config() { if (!isset(self::$config->no_extension_markdown)) { self::$config->no_extension_markdown = true; } + + if (!isset(self::$config->break_code_blocks)) { + self::$config->break_code_blocks = false; + } } diff --git a/src/templates/main.html b/src/templates/main.html index d3ef9bf..d93fca8 100644 --- a/src/templates/main.html +++ b/src/templates/main.html @@ -25,6 +25,11 @@ +