jupyter / jupyter/nbformat

How do I set syntax highlighting style in API Use

Open
#227 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
313
Forks
176
PR merge metrics
No merged PRs in 30d

Description

Hey everyone,

quick question: How do I set a custom syntax hightlighting style, when using nbformat via API. Configuring it that way has no effect:
```py

c = Config()
c.CSSHTMLHeaderPreprocessor.style = "monokai" # Should set different style
html_exporter = HTMLExporter(config=c)
(body, _) = html_exporter.from_notebook_node( nbformat.reads(content))
```
I couldn't find something in the Documentation [only for CLI use](https://nbconvert.readthedocs.io/en/latest/highlighting.html).

Thanks in Advance!

Contributor guide

Open the contributing guide

Research direction

Start with the API example using Config, CSSHTMLHeaderPreprocessor, HTMLExporter, and nbformat.reads, then compare it with the linked nbconvert highlighting documentation. Clarify whether custom syntax highlighting can be configured through the API and document the supported usage and expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.