Skip to content

Commit

Permalink
v1.9.4 CodeBackground and CodeForeground
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinPacker committed Mar 21, 2021
1 parent 3da6773 commit 4c9c4e3
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 22 deletions.
2 changes: 1 addition & 1 deletion md2pptx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ try:
except:
have_cairosvg = False

md2pptx_level = "1.9.3"
md2pptx_level = "1.9.4"
md2pptx_date = "21 March, 2021"


Expand Down
43 changes: 37 additions & 6 deletions user-guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -1106,11 +1106,13 @@ <h3 id="table-of-contents">Table Of Contents<a class="headerlink" href="#table-o
<li><a href="#card-shape-cardshape">Card Shape - <code>CardShape</code></a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#code-slide-metadata">Code Slide Metadata</a><ul>
<li><a href="#code-column-count-codecolumns">Code Column Count - <code>CodeColumns</code></a></li>
<li><a href="#fixed-pitch-height-to-width-ratio-fpratio">Fixed Pitch Height To Width Ratio - <code>FPRatio</code></a></li>
<li><a href="#foreground-colour-codeforeground">Foreground Colour - <code>CodeForeground</code></a></li>
<li><a href="#background-colour-codebackground">Background Colour - <code>CodeBackground</code></a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#dynamic-metadata">Dynamic Metadata</a><ul>
Expand All @@ -1125,6 +1127,8 @@ <h3 id="table-of-contents">Table Of Contents<a class="headerlink" href="#table-o
<li><a href="#basetextdecrement"><code>BaseTextDecrement</code></a></li>
<li><a href="#codecolumns"><code>CodeColumns</code></a></li>
<li><a href="#fpratio"><code>FPRatio</code></a></li>
<li><a href="#codeforeground"><code>CodeForeground</code></a></li>
<li><a href="#codebackground"><code>CodeBackground</code></a></li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -1232,6 +1236,11 @@ <h2 id="change-log">Change Log<a class="headerlink" href="#change-log" title="Pe
</thead>
<tbody>
<tr>
<td align="left">1.9.4</td>
<td align="right">21&nbsp;March&nbsp;2021</td>
<td align="left">Added controls code slide foreground and background colour RGB values.</td>
</tr>
<tr>
<td align="left">1.9.3</td>
<td align="right">21&nbsp;March&nbsp;2021</td>
<td align="left">Added controls on how many columns wide code is and fixed pitch height to width ratio.</td>
Expand Down Expand Up @@ -1674,7 +1683,7 @@ <h3 id="code-slides">Code Slides<a class="headerlink" href="#code-slides" title=
</ul>
<p>When we say &ldquo;code&rdquo;, what you&rsquo;re displaying could be something like a terminal screen shot, of course. What&rsquo;s important is that it will be rendered in a fixed-pitch font.</p>
<p>In each case, the heading for the slide is generally introduced with heading level 3 - <code>###</code>. However you can start a slide without a heading. See <a href="#slides-without-titles">Slides Without Titles</a> for how to do this.</p>
<p><strong>Note:</strong> You can more precisely control how code slides are laid out with <a href="#code-slide-metadata">Code Slide Metadata</a>.</p>
<p><strong>Note:</strong> You can more precisely control how code slides are laid out and their colours with <a href="#code-slide-metadata">Code Slide Metadata</a>.</p>
<h4 id="code"><code>&lt;code&gt;</code><a class="headerlink" href="#code" title="Permanent link"></a></h4>
<p>The HTML <code>&lt;code&gt;</code> element is supported. Surround the block of text by <code>&lt;code&gt;</code> and <code>&lt;/code</code>:</p>
<pre><code>### This Is A Code Slide
Expand Down Expand Up @@ -2429,21 +2438,33 @@ <h5 id="card-shape-cardshape">Card Shape - <code>CardShape</code><a class="heade
<p>The default value is <code>rounded</code>.</p>
<p>You can override this value on a slide-by-slide basis with <a href="#cardshape-dynamic">Dynamic CardShape</a>.</p>
<p><a id="code-slide-metadata"></></p>
<h3 id="code-slide-metadata">Code Slide Metadata<a class="headerlink" href="#code-slide-metadata" title="Permanent link"></a></h3>
<h4 id="code-slide-metadata">Code Slide Metadata<a class="headerlink" href="#code-slide-metadata" title="Permanent link"></a></h4>
<p>You can adjust how code slides display their content.</p>
<p><a id="code-column-count-codecolumns"></a></p>
<h4 id="code-column-count-codecolumns">Code Column Count - <code>CodeColumns</code><a class="headerlink" href="#code-column-count-codecolumns" title="Permanent link"></a></h4>
<h5 id="code-column-count-codecolumns">Code Column Count - <code>CodeColumns</code><a class="headerlink" href="#code-column-count-codecolumns" title="Permanent link"></a></h5>
<p>You can adjust how wide the text box the code is displayed in using <code>CodeColumns</code>. For example:</p>
<pre><code>CodeColumns: 70
</code></pre>
<p>The default value is 80.</p>
<p>You can override this on a slide-by-slide basis with <a href="#dynamic-codecolumns">Dynamic CodeColumns</a>.</p>
<p><a id="fixed-pitch-height-to-width-ration-fpratio"></a></p>
<h4 id="fixed-pitch-height-to-width-ratio-fpratio">Fixed Pitch Height To Width Ratio - <code>FPRatio</code><a class="headerlink" href="#fixed-pitch-height-to-width-ratio-fpratio" title="Permanent link"></a></h4>
<h5 id="fixed-pitch-height-to-width-ratio-fpratio">Fixed Pitch Height To Width Ratio - <code>FPRatio</code><a class="headerlink" href="#fixed-pitch-height-to-width-ratio-fpratio" title="Permanent link"></a></h5>
<p>md2pptx assumes the height of a column is 1.2 times its width. You can adjust this ratio with <code>FPRatio</code>:</p>
<pre><code>FPRatio: 1.1
</code></pre>
<p>You can override this on a slide-by-slide basis with <a href="#dynamic-fpratio">Dynamic FPRatio</a>.</p>
<p><a id="foreground-colour-codeforeground"></a></p>
<h5 id="foreground-colour-codeforeground">Foreground Colour - <code>CodeForeground</code><a class="headerlink" href="#foreground-colour-codeforeground" title="Permanent link"></a></h5>
<p>The default foreground colour for code slides is black (#000000 in RGB terms). You can override this by specifying an RGB colour, such as white:</p>
<pre><code>CodeForeground: FFFFFF
</code></pre>
<p>You can override this on a slide-by-slide basis with <a href="#dynamic-codeforeground">Dynamic CodeForeground</a>.</p>
<p><a id="background-colour-codebackground"></a></p>
<h5 id="background-colour-codebackground">Background Colour - <code>CodeBackground</code><a class="headerlink" href="#background-colour-codebackground" title="Permanent link"></a></h5>
<p>The default background colour for code slides is white (#FFFFFF in RGB terms). You can override this by specifying an RGB colour, such as black:</p>
<pre><code>codeBackground: 000000
</code></pre>
<p>You can override this on a slide-by-slide basis with <a href="#dynamic-codebackground">Dynamic codeBackground</a>.</p>
<p><a id="dynamic-metadata"></a></p>
<h3 id="dynamic-metadata">Dynamic Metadata<a class="headerlink" href="#dynamic-metadata" title="Permanent link"></a></h3>
<p>md2pptx can alter some in-effect settings, starting at a particular slide. Straight after the heading code a special form of comment like so:</p>
Expand Down Expand Up @@ -2519,6 +2540,16 @@ <h4 id="fpratio"><code>FPRatio</code><a class="headerlink" href="#fpratio" title
<pre><code>&lt;!-- md2pptx: fpratio: 1.3 --&gt;
</code></pre>
<p>The above changes the <code>FPRatio</code> value for this and subsequent slides to 1.3.</p>
<p><a id="dynamic-codeforeground"></a></p>
<h4 id="codeforeground"><code>CodeForeground</code><a class="headerlink" href="#codeforeground" title="Permanent link"></a></h4>
<p>You can override the presentation <a href="#foreground-colour-codeforeground">CodeForeground</a> code slide foreground colour on a slide-by-slide basis:</p>
<pre><code>&lt;!-- md2pptx: codeforeground: 000000 --&gt;
</code></pre>
<p><a id="dynamic-codebackground"></a></p>
<h4 id="codebackground"><code>CodeBackground</code><a class="headerlink" href="#codebackground" title="Permanent link"></a></h4>
<p>You can override the presentation <a href="#background-colour-codebackground">CodeBackground</a> code slide background colour on a slide-by-slide basis:</p>
<pre><code>&lt;!-- md2pptx: codebackground: FFFFFF --&gt;
</code></pre>
<h2 id="modifying-the-slide-template">Modifying The Slide Template<a class="headerlink" href="#modifying-the-slide-template" title="Permanent link"></a></h2>
<p><a id="modifying-the-slide-template"></a></p>
<p>The included template presentation - Martin Template.pptx - is what the author tested with and gives good results. However, you probably want to develop your own template from it.</p>
Expand Down
12 changes: 8 additions & 4 deletions user-guide.log
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mdpre Markdown Preprocessor v0.4.6 (26 January, 2021)
Def mdpre_date = 26 January, 2021
Def mdpre_level = 0.4.6
Def userid = martinpacker
Def time = 19&colon;43
Def time = 20&colon;05
Def date = 21 March&comma; 2021
Def TOC = Table Of Contents
Def md = Markdown
Expand Down Expand Up @@ -97,9 +97,11 @@ CSV Stop
..... ..... ..... ..... Card Title Alignment - `CardTitleAlign`
..... ..... ..... ..... Card Title Position - `CardTitlePosition`
..... ..... ..... ..... Card Shape - `CardShape`
..... ..... Code Slide Metadata
..... ..... ..... Code Column Count - `CodeColumns`
..... ..... ..... Fixed Pitch Height To Width Ratio - `FPRatio`
..... ..... ..... Code Slide Metadata
..... ..... ..... ..... Code Column Count - `CodeColumns`
..... ..... ..... ..... Fixed Pitch Height To Width Ratio - `FPRatio`
..... ..... ..... ..... Foreground Colour - `CodeForeground`
..... ..... ..... ..... Background Colour - `CodeBackground`
..... ..... Dynamic Metadata
..... ..... ..... `CompactTables`
..... ..... ..... `CardPercent`
Expand All @@ -112,6 +114,8 @@ CSV Stop
..... ..... ..... `BaseTextDecrement`
..... ..... ..... `CodeColumns`
..... ..... ..... `FPRatio`
..... ..... ..... `CodeForeground`
..... ..... ..... `CodeBackground`
..... Modifying The Slide Template
..... ..... Basics
..... ..... Slide Template Sequence
Expand Down
51 changes: 44 additions & 7 deletions user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ In this document we'll refer to it as "md2pptx", pronounced "em dee to pee pee t
* [Card Title Alignment - `CardTitleAlign`](#card-title-alignment-cardtitlealign)
* [Card Title Position - `CardTitlePosition`](#card-title-position-cardtitleposition)
* [Card Shape - `CardShape`](#card-shape-cardshape)
* [Code Slide Metadata](#code-slide-metadata)
* [Code Column Count - `CodeColumns`](#code-column-count-codecolumns)
* [Fixed Pitch Height To Width Ratio - `FPRatio`](#fixed-pitch-height-to-width-ratio-fpratio)
* [Code Slide Metadata](#code-slide-metadata)
* [Code Column Count - `CodeColumns`](#code-column-count-codecolumns)
* [Fixed Pitch Height To Width Ratio - `FPRatio`](#fixed-pitch-height-to-width-ratio-fpratio)
* [Foreground Colour - `CodeForeground`](#foreground-colour-codeforeground)
* [Background Colour - `CodeBackground`](#background-colour-codebackground)
* [Dynamic Metadata](#dynamic-metadata)
* [`CompactTables`](#compacttables)
* [`CardPercent`](#cardpercent)
Expand All @@ -99,6 +101,8 @@ In this document we'll refer to it as "md2pptx", pronounced "em dee to pee pee t
* [`BaseTextDecrement`](#basetextdecrement)
* [`CodeColumns`](#codecolumns)
* [`FPRatio`](#fpratio)
* [`CodeForeground`](#codeforeground)
* [`CodeBackground`](#codebackground)
* [Modifying The Slide Template](#modifying-the-slide-template)
* [Basics](#basics)
* [Slide Template Sequence](#slide-template-sequence)
Expand Down Expand Up @@ -210,6 +214,7 @@ To quote from the python-pptx license statement:

|Level|Date|What|
|:-|-:|:-|
|1.9.4|21&nbsp;March&nbsp;2021|Added controls code slide foreground and background colour RGB values.|
|1.9.3|21&nbsp;March&nbsp;2021|Added controls on how many columns wide code is and fixed pitch height to width ratio.|
|1.9.2|16&nbsp;March&nbsp;2021|Added `<pre>`&comma; `<code>`&comma; triple backtick - with `<span>` colouring for `<pre>`. Added ways to make a no-title slide.|
|1.9.1|6&nbsp;March&nbsp;2021|Added `&check;` entity reference. Reworked internals with more consistent layout and `getContentRec` and title formatting improvements. Prereq Python 3.8.|
Expand Down Expand Up @@ -604,7 +609,7 @@ When we say "code", what you're displaying could be something like a terminal sc

In each case, the heading for the slide is generally introduced with heading level 3 - `### `. However you can start a slide without a heading. See [Slides Without Titles](#slides-without-titles) for how to do this.

**Note:** You can more precisely control how code slides are laid out with [Code Slide Metadata](#code-slide-metadata).
**Note:** You can more precisely control how code slides are laid out and their colours with [Code Slide Metadata](#code-slide-metadata).

#### `<code>`

Expand Down Expand Up @@ -1462,12 +1467,12 @@ The default value is `rounded`.
You can override this value on a slide-by-slide basis with [Dynamic CardShape](#cardshape-dynamic).

<a id="code-slide-metadata"></>
### Code Slide Metadata
#### Code Slide Metadata

You can adjust how code slides display their content.

<a id="code-column-count-codecolumns"></a>
#### Code Column Count - `CodeColumns`
##### Code Column Count - `CodeColumns`

You can adjust how wide the text box the code is displayed in using `CodeColumns`. For example:

Expand All @@ -1479,14 +1484,32 @@ The default value is 80.
You can override this on a slide-by-slide basis with [Dynamic CodeColumns](#dynamic-codecolumns).

<a id="fixed-pitch-height-to-width-ration-fpratio"></a>
#### Fixed Pitch Height To Width Ratio - `FPRatio`
##### Fixed Pitch Height To Width Ratio - `FPRatio`

md2pptx assumes the height of a column is 1.2 times its width. You can adjust this ratio with `FPRatio`:

FPRatio: 1.1

You can override this on a slide-by-slide basis with [Dynamic FPRatio](#dynamic-fpratio).

<a id="foreground-colour-codeforeground"></a>
##### Foreground Colour - `CodeForeground`

The default foreground colour for code slides is black (#000000 in RGB terms). You can override this by specifying an RGB colour, such as white:

CodeForeground: FFFFFF

You can override this on a slide-by-slide basis with [Dynamic CodeForeground](#dynamic-codeforeground).

<a id="background-colour-codebackground"></a>
##### Background Colour - `CodeBackground`

The default background colour for code slides is white (#FFFFFF in RGB terms). You can override this by specifying an RGB colour, such as black:

codeBackground: 000000

You can override this on a slide-by-slide basis with [Dynamic codeBackground](#dynamic-codebackground).

<a id="dynamic-metadata"></a>
### Dynamic Metadata

Expand Down Expand Up @@ -1597,6 +1620,20 @@ You can override the presentation [FPRatio](#fixed-pitch-height-to-width-ration-

The above changes the `FPRatio` value for this and subsequent slides to 1.3.

<a id="dynamic-codeforeground"></a>
#### `CodeForeground`

You can override the presentation [CodeForeground](#foreground-colour-codeforeground) code slide foreground colour on a slide-by-slide basis:

<!-- md2pptx: codeforeground: 000000 -->

<a id="dynamic-codebackground"></a>
#### `CodeBackground`

You can override the presentation [CodeBackground](#background-colour-codebackground) code slide background colour on a slide-by-slide basis:

<!-- md2pptx: codebackground: FFFFFF -->

## Modifying The Slide Template
<a id="modifying-the-slide-template"></a>

Expand Down
43 changes: 39 additions & 4 deletions user-guide.mdp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ To quote from the python-pptx license statement:
=colalign l r l
=csv
Level,Date,What
1.9.4,21&nbsp;March&nbsp;2021,Added controls code slide foreground and background colour RGB values.
1.9.3,21&nbsp;March&nbsp;2021,Added controls on how many columns wide code is and fixed pitch height to width ratio.
1.9.2,16&nbsp;March&nbsp;2021,Added `<pre>`&comma; `<code>`&comma; triple backtick - with `<span>` colouring for `<pre>`. Added ways to make a no-title slide.
1.9.1,6&nbsp;March&nbsp;2021,Added `&check;` entity reference. Reworked internals with more consistent layout and `getContentRec` and title formatting improvements. Prereq Python 3.8.
Expand Down Expand Up @@ -570,7 +571,7 @@ In each case, the heading for the slide is generally introduced with heading lev
However you can start a slide without a heading. \
See [Slides Without Titles](#slides-without-titles) for how to do this.

**Note:** You can more precisely control how code slides are laid out with [Code Slide Metadata](#code-slide-metadata).
**Note:** You can more precisely control how code slides are laid out and their colours with [Code Slide Metadata](#code-slide-metadata).

#### `<code>`

Expand Down Expand Up @@ -1502,12 +1503,12 @@ The default value is `rounded`.
You can override this value on a slide-by-slide basis with [Dynamic CardShape](#cardshape-dynamic).

<a id="code-slide-metadata"></>
### Code Slide Metadata
#### Code Slide Metadata

You can adjust how code slides display their content.

<a id="code-column-count-codecolumns"></a>
#### Code Column Count - `CodeColumns`
##### Code Column Count - `CodeColumns`

You can adjust how wide the text box the code is displayed in using `CodeColumns`. \
For example:
Expand All @@ -1520,7 +1521,7 @@ The default value is 80.
You can override this on a slide-by-slide basis with [Dynamic CodeColumns](#dynamic-codecolumns).

<a id="fixed-pitch-height-to-width-ration-fpratio"></a>
#### Fixed Pitch Height To Width Ratio - `FPRatio`
##### Fixed Pitch Height To Width Ratio - `FPRatio`

md2pptx assumes the height of a column is 1.2 times its width. \
You can adjust this ratio with `FPRatio`:
Expand All @@ -1529,6 +1530,26 @@ You can adjust this ratio with `FPRatio`:

You can override this on a slide-by-slide basis with [Dynamic FPRatio](#dynamic-fpratio).

<a id="foreground-colour-codeforeground"></a>
##### Foreground Colour - `CodeForeground`

The default foreground colour for code slides is black (#000000 in RGB terms). \
You can override this by specifying an RGB colour, such as white:

CodeForeground: FFFFFF

You can override this on a slide-by-slide basis with [Dynamic CodeForeground](#dynamic-codeforeground).

<a id="background-colour-codebackground"></a>
##### Background Colour - `CodeBackground`

The default background colour for code slides is white (#FFFFFF in RGB terms). \
You can override this by specifying an RGB colour, such as black:

codeBackground: 000000

You can override this on a slide-by-slide basis with [Dynamic codeBackground](#dynamic-codebackground).

<a id="dynamic-metadata"></a>
### Dynamic Metadata

Expand Down Expand Up @@ -1642,6 +1663,20 @@ For example:

The above changes the `FPRatio` value for this and subsequent slides to 1.3.

<a id="dynamic-codeforeground"></a>
#### `CodeForeground`

You can override the presentation [CodeForeground](#foreground-colour-codeforeground) code slide foreground colour on a slide-by-slide basis:

<!-- md2pptx: codeforeground: 000000 -->

<a id="dynamic-codebackground"></a>
#### `CodeBackground`

You can override the presentation [CodeBackground](#background-colour-codebackground) code slide background colour on a slide-by-slide basis:

<!-- md2pptx: codebackground: FFFFFF -->

## Modifying The Slide Template
<a id="modifying-the-slide-template"></a>

Expand Down

0 comments on commit 4c9c4e3

Please sign in to comment.