Skip to content

Commit

Permalink
Add code-block-height option for reveal
Browse files Browse the repository at this point in the history
Fixes #1943
  • Loading branch information
dragonstyle committed Nov 30, 2023
1 parent a381c4d commit bcc2534
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 27 deletions.
1 change: 1 addition & 0 deletions news/changelog-1.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@

## RevealJS Format

- ([#1943](https://github.com/quarto-dev/quarto-cli/issues/1943)): Allow setting `code-block-height` in presentation front matter.
- ([#5546](https://github.com/quarto-dev/quarto-cli/issues/5546)): Images inside links can't be stretched, and so auto-stretch feature now ignores them.
- ([#5783](https://github.com/quarto-dev/quarto-cli/issues/5783)): Ensure fenced code blocks work with line numbers.
- ([#6120](https://github.com/quarto-dev/quarto-cli/issues/6120)): `pdf-max-pages-per-slide` is now correctly setting [`pdfMaxPagesPerSlide` config](https://revealjs.com/pdf-export/#page-size) for RevealJS.
Expand Down
1 change: 1 addition & 0 deletions src/format/reveal/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ export const kAutoAnimateEasing = "autoAnimateEasing";
export const kAutoAnimateDuration = "autoAnimateDuration";
export const kAutoAnimateUnmatched = "autoAnimateUnmatched";
export const kAutoStretch = "auto-stretch";
export const kCodeBlockHeight = "code-block-height";
5 changes: 4 additions & 1 deletion src/format/reveal/format-reveal-theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
sassVariable,
} from "../../core/sass.ts";

import { kRevealJsUrl } from "./constants.ts";
import { kCodeBlockHeight, kRevealJsUrl } from "./constants.ts";
import { resolveTextHighlightingLayer } from "../html/format-html-scss.ts";
import { quartoBaseLayer } from "../html/format-html-shared.ts";
import { TempContext } from "../../core/temp.ts";
Expand Down Expand Up @@ -247,6 +247,9 @@ function pandocVariablesToRevealDefaults(
asCssNumber,
);
add(explicitVars, "code-block-bg", metadata["monobackgroundcolor"]);

// Non-pandoc options from front matter
add(explicitVars, "code-block-height", metadata[kCodeBlockHeight]);
return explicitVars;
}

Expand Down
26 changes: 19 additions & 7 deletions src/resources/editor/tools/vs-code.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7957,7 +7957,7 @@ var require_yaml_intelligence_resources = __commonJS({
"margin"
]
},
default: "inline",
default: "bottom",
description: "Where to place figure and table captions (`top`, `bottom`, or `margin`)"
},
{
Expand All @@ -7979,7 +7979,7 @@ var require_yaml_intelligence_resources = __commonJS({
"margin"
]
},
default: "inline",
default: "bottom",
description: "Where to place figure captions (`top`, `bottom`, or `margin`)"
},
{
Expand All @@ -8001,7 +8001,7 @@ var require_yaml_intelligence_resources = __commonJS({
"margin"
]
},
default: "inline",
default: "top",
description: "Where to place table captions (`top`, `bottom`, or `margin`)"
}
],
Expand Down Expand Up @@ -16750,6 +16750,17 @@ var require_yaml_intelligence_resources = __commonJS({
schema: "boolean",
default: false,
description: "Disables the default reveal.js slide layout (scaling and centering)\n"
},
{
name: "code-block-height",
tags: {
formats: [
"revealjs"
]
},
schema: "string",
default: "500px",
description: "Sets the maximum height for source code blocks that appear in the presentation.\n"
}
],
"schema/document-reveal-media.yml": [
Expand Down Expand Up @@ -20373,6 +20384,7 @@ var require_yaml_intelligence_resources = __commonJS({
short: "Collapse code into an HTML <code>&lt;details&gt;</code> tag so the\nuser can display it on-demand.",
long: "Collapse code into an HTML <code>&lt;details&gt;</code> tag so the\nuser can display it on-demand."
},
"Summary text to use for code blocks collapsed using\n<code>code-fold</code>",
{
short: "Choose whether to <code>scroll</code> or <code>wrap</code> when code\nlines are too wide for their container.",
long: "Choose how to handle code overflow, when code lines are too wide for\ntheir container. One of:"
Expand Down Expand Up @@ -22256,7 +22268,7 @@ var require_yaml_intelligence_resources = __commonJS({
"Disambiguating year suffix in author-date styles (e.g.&nbsp;\u201Ca\u201D in \u201CDoe,\n1999a\u201D).",
"Manuscript configuration",
"internal-schema-hack",
"Summary text to use for code blocks collapsed using\n<code>code-fold</code>"
"Sets the maximum height for source code blocks that appear in the\npresentation."
],
"schema/external-schemas.yml": [
{
Expand Down Expand Up @@ -22480,12 +22492,12 @@ var require_yaml_intelligence_resources = __commonJS({
mermaid: "%%"
},
"handlers/mermaid/schema.yml": {
_internalId: 178607,
_internalId: 178765,
type: "object",
description: "be an object",
properties: {
"mermaid-format": {
_internalId: 178599,
_internalId: 178757,
type: "enum",
enum: [
"png",
Expand All @@ -22501,7 +22513,7 @@ var require_yaml_intelligence_resources = __commonJS({
exhaustiveCompletions: true
},
theme: {
_internalId: 178606,
_internalId: 178764,
type: "anyOf",
anyOf: [
{
Expand Down
26 changes: 19 additions & 7 deletions src/resources/editor/tools/yaml/web-worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 19 additions & 7 deletions src/resources/editor/tools/yaml/yaml-intelligence-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@
"margin"
]
},
"default": "inline",
"default": "bottom",
"description": "Where to place figure and table captions (`top`, `bottom`, or `margin`)"
},
{
Expand All @@ -951,7 +951,7 @@
"margin"
]
},
"default": "inline",
"default": "bottom",
"description": "Where to place figure captions (`top`, `bottom`, or `margin`)"
},
{
Expand All @@ -973,7 +973,7 @@
"margin"
]
},
"default": "inline",
"default": "top",
"description": "Where to place table captions (`top`, `bottom`, or `margin`)"
}
],
Expand Down Expand Up @@ -9722,6 +9722,17 @@
"schema": "boolean",
"default": false,
"description": "Disables the default reveal.js slide layout (scaling and centering)\n"
},
{
"name": "code-block-height",
"tags": {
"formats": [
"revealjs"
]
},
"schema": "string",
"default": "500px",
"description": "Sets the maximum height for source code blocks that appear in the presentation.\n"
}
],
"schema/document-reveal-media.yml": [
Expand Down Expand Up @@ -13345,6 +13356,7 @@
"short": "Collapse code into an HTML <code>&lt;details&gt;</code> tag so the\nuser can display it on-demand.",
"long": "Collapse code into an HTML <code>&lt;details&gt;</code> tag so the\nuser can display it on-demand."
},
"Summary text to use for code blocks collapsed using\n<code>code-fold</code>",
{
"short": "Choose whether to <code>scroll</code> or <code>wrap</code> when code\nlines are too wide for their container.",
"long": "Choose how to handle code overflow, when code lines are too wide for\ntheir container. One of:"
Expand Down Expand Up @@ -15228,7 +15240,7 @@
"Disambiguating year suffix in author-date styles (e.g.&nbsp;“a” in “Doe,\n1999a”).",
"Manuscript configuration",
"internal-schema-hack",
"Summary text to use for code blocks collapsed using\n<code>code-fold</code>"
"Sets the maximum height for source code blocks that appear in the\npresentation."
],
"schema/external-schemas.yml": [
{
Expand Down Expand Up @@ -15452,12 +15464,12 @@
"mermaid": "%%"
},
"handlers/mermaid/schema.yml": {
"_internalId": 178607,
"_internalId": 178765,
"type": "object",
"description": "be an object",
"properties": {
"mermaid-format": {
"_internalId": 178599,
"_internalId": 178757,
"type": "enum",
"enum": [
"png",
Expand All @@ -15473,7 +15485,7 @@
"exhaustiveCompletions": true
},
"theme": {
"_internalId": 178606,
"_internalId": 178764,
"type": "anyOf",
"anyOf": [
{
Expand Down
4 changes: 2 additions & 2 deletions src/resources/formats/revealjs/quarto.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ $reveal-title-slide-text-align: $presentation-title-slide-text-align !default;
$code-block-bg: $body-bg !default;
$code-block-border-color: lighten($body-color, 60%) !default;
$code-block-font-size: 0.55em !default;
$code-block-max-height: 500px !default;
$code-block-height: 500px !default;

// inline code
$code-color: var(--quarto-hl-fu-color) !default;
Expand Down Expand Up @@ -251,7 +251,7 @@ div.reveal div.slides section.quarto-title-block {
}
background-color: $code-block-bg;
padding: 6px 9px;
max-height: $code-block-max-height;
max-height: $code-block-height;
white-space: pre;
}

Expand Down
6 changes: 3 additions & 3 deletions src/resources/schema/cell-pagelayout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
formats: [$html-files, $pdf-all]
schema:
enum: [top, bottom, margin]
default: inline
default: bottom
description: "Where to place figure and table captions (`top`, `bottom`, or `margin`)"

- name: fig-cap-location
Expand All @@ -34,7 +34,7 @@
formats: [$html-files, $pdf-all]
schema:
enum: [top, bottom, margin]
default: inline
default: bottom
description: "Where to place figure captions (`top`, `bottom`, or `margin`)"

- name: tbl-cap-location
Expand All @@ -43,5 +43,5 @@
formats: [$html-files, $pdf-all]
schema:
enum: [top, bottom, margin]
default: inline
default: top
description: "Where to place table captions (`top`, `bottom`, or `margin`)"
8 changes: 8 additions & 0 deletions src/resources/schema/document-reveal-layout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,11 @@
default: false
description: |
Disables the default reveal.js slide layout (scaling and centering)

- name: code-block-height
tags:
formats: [revealjs]
schema: string
default: "500px"
description: |
Sets the maximum height for source code blocks that appear in the presentation.

0 comments on commit bcc2534

Please sign in to comment.