ipypublish.preprocessors.slides_from_markdown module¶
-
class
ipypublish.preprocessors.slides_from_markdown.
FinalCells
(header_slide)[source]¶ Bases:
object
a class that stores cells
-
class
ipypublish.preprocessors.slides_from_markdown.
MarkdownSlides
(*args, **kwargs)[source]¶ Bases:
nbconvert.preprocessors.base.Preprocessor
a preprocessor to setup the notebook as an ipyslideshow, according to a set of rules
markdown cells containaing # headers are broken into individual cells
any cells where ipub.ignore=True is set to ‘skip’
any code cells with no other ipub tags are set to ‘skip’
any header level >= column_level starts a new column
else, any header level >= row_level starts a new row
if max_cells is not 0, then breaks to a new row after <max_cells> cells
-
autonumbering
¶ A boolean (True, False) trait.
-
column_level
¶ An int trait.
-
header_slide
¶ A boolean (True, False) trait.
-
max_cells
¶ An int trait.
-
preprocess
(nb, resources)[source]¶ Preprocessing to apply on each notebook.
Must return modified nb, resources.
If you wish to apply your preprocessing to each cell, you might want to override preprocess_cell method instead.
- Parameters
nb (
NotebookNode
) – Notebook being convertedresources (
dictionary
) – Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
-
row_level
¶ An int trait.
-
ipypublish.preprocessors.slides_from_markdown.
header_level
(line)[source]¶ Examples
>>> header_level('# title') 1 >>> header_level('### title') 3
-
ipypublish.preprocessors.slides_from_markdown.
is_header
(line, max_level)[source]¶ if max_level is 0 assumes all headers ok
Examples
>>> is_header("abc",0) False >>> is_header("#",0) False >>> is_header("# title",0) True >>> is_header("### title",3) True >>> is_header("### title",2) False
-
ipypublish.preprocessors.slides_from_markdown.
number_title
(line, current_levels)[source]¶ Examples
>>> number_title("# title",[]) ('# 1. title', [1]) >>> number_title("## title",[]) ('## 1.1. title', [1, 1]) >>> number_title("# title",[1,1]) ('# 2. title', [2]) >>> number_title("## title",[2,1]) ('## 2.2. title', [2, 2]) >>> number_title("### title a#bc",[2]) ('### 2.1.1. title a#bc', [2, 1, 1]) >>> number_title("### title a#bc",[2,1,2,3]) ('### 2.1.3. title a#bc', [2, 1, 3])