Skip to content

Commit

Permalink
Added new option: break_code_blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
xy2z committed Apr 3, 2020
1 parent ece6e9d commit 42780f7
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions config/config-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion public/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ blockquote {

#content_wrapper pre code {
display: block;
white-space: pre-wrap;
padding: 1em;
border-radius: 2px;
}
Expand Down
1 change: 1 addition & 0 deletions public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand Down
4 changes: 4 additions & 0 deletions src/PineDocs.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}


Expand Down
5 changes: 5 additions & 0 deletions src/templates/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/[email protected]/build/css/alertify.min.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/[email protected]/build/css/themes/default.min.css">
<link href="https://fonts.googleapis.com/css?family=Fugaz+One|Open+Sans&display=swap" rel="stylesheet">
<style>
#content_wrapper pre code {
white-space: {{ config.break_code_blocks ? 'pre-wrap' : 'nowrap' }};
}
</style>
</head>

<body>
Expand Down

0 comments on commit 42780f7

Please sign in to comment.