Skip to content

Commit e47528e

Browse files
authored
Merge pull request #36 from oreillymedia/update-sidebar-heading-levels
Update sidebar heading levels
2 parents 651d6b4 + ba62cd1 commit e47528e

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
Takes a Jupyter Book and turns it into an HTMLBook-compliant project for consumption in Atlas, O'Reilly's book building tool. The script runs `jupyter-book` on your book directory (the one containing your *_config.yml* and *_toc.yml* files), and puts HTMLBook files in the specified target directory, updating atlas.json if it's provided.
44

5-
**IMPORTANT**: We're now at 1.0.0, i.e., we have introduced a very breaking-change from the original version of the script!
5+
**IMPORTANT**: We're now at >1.0.0, i.e., we have introduced a very breaking-change from the original version of the script!
66

77
## Installation
88

99
**NOTE**: This tool requires Python ^3.9.
1010

11-
It's not on PYPI yet, so install via the GitHub link:
11+
Install via the GitHub link:
1212

1313
```
1414
pip install git+https://github.com/oreillymedia/jupyter-book-to-htmlbook.git
@@ -54,6 +54,8 @@ Options:
5454
--skip-jb-build Skip running `jupyter-book` as a part of
5555
this conversion
5656
--skip-numbering Skip the numbering of In[]/Out[] code cells
57+
--include-root Include the 'root' file of the jupyter-book
58+
project
5759
--version
5860
--install-completion [bash|zsh|fish|powershell|pwsh]
5961
Install completion for the specified shell.
@@ -64,11 +66,9 @@ Options:
6466
6567
```
6668

67-
## Known Limitations
69+
## Current Known Limitations
6870

69-
* Cross references to bare files (e.g., `see [chapter 1](chapter01.ipynb)`) aren't converting as expected; in the meantime please use a heading anchor (e.g., `see [chapter 1](chapter01.ipynb#first-heading)`).
70-
* The `"pagenumrestart"` class is currently applied to the first chapter with parts (assuming that the chapters are numbered); this is a limitation to be overcome later (if there is a single-file chapter 1, a part, etc.).
71-
* Currently, bibliography references are "opinionated," and are meant to follow CMS author-date in terms of in-text citations (no work has been done on the actual *references.html* yet).
71+
* Jupyter Book can only process one metadata-named code-generated figure per file. The workaround for this is to save any resultant figures to disk and refer to them as any other figure.
7272

7373
## Release Notes
7474

@@ -78,6 +78,7 @@ Features:
7878
- Add support for formal code examples in Python and R via the "example" cell tag
7979
- Add support for glossaries
8080
- Add basic support for bibtex bibliographies
81+
- Align sidebar heading levels with changes in Atlas
8182

8283
Bug fixes:
8384
- Fix bug with top-level heading IDs causing xrefs to fail

jupyter_book_to_htmlbook/text_processing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,6 @@ def process_sidebars(chapter):
7272

7373
if aside.find("p", class_="sidebar-title"):
7474
title = aside.find("p", class_="sidebar-title")
75-
title.name = "h5"
75+
title.name = "h1"
7676

7777
return chapter

tests/test_text_processing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,4 @@ def test_sidebar_processing():
9696
</aside>""", "html.parser")
9797
process_sidebars(chapter_text)
9898
assert chapter_text.find("aside")["data-type"] == "sidebar"
99-
assert chapter_text.find("h5").string == "Here Is a Sidebar Title"
99+
assert chapter_text.find("h1").string == "Here Is a Sidebar Title"

0 commit comments

Comments
 (0)