Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codeblocks now have line numbers, highlighting, bg override #189

Merged

Conversation

d0c-s4vage
Copy link
Owner

@d0c-s4vage d0c-s4vage commented Dec 11, 2022

Adds the ability to enable line numbers in code blocks and highlight lines

Specifically:

  • Curly brace attributes on code blocks are now supported
  • the theme can now be set in the YAML metadata:
    ---
    theme: light
    ---
  • a new styles.code YAML metadata value can be used:
    ---
    styles:
      code:
        style: zenburn
        inline_lang: python
        bg_override: "#aabbcc"
    ---
  • the --style CLI argument is removed (should be replaced by the feature described in 3.0 - Change the --style CLI argument to set styles via dot-notation #190)

See #164
See #89

@d0c-s4vage d0c-s4vage marked this pull request as ready for review December 11, 2022 16:03
@d0c-s4vage
Copy link
Owner Author

From this markdown:

---
theme: dark
styles:
  slides:
    fg: "#c0c08f"
  code:
    style: monokai
    inline_lang: python
    bg_override: "#302030"
---

The `a = 100 * "hello"` metadata that can be prefixed in slides includes these top level
fields:

```python {.numberLines startFrom="1" hllines=1,5,7-9 .nobackground}
def hello():
    """Text
    """
    # comment
    print("Hello world")
    print("Hello world")
    a = 1 * 20 + 30
    X = 1 * 20 + 30
    y = 1 * 20 + 30
    a = 1 * 20 + 30
    k = 1 * 20 + 30
```

You get this:

image

@d0c-s4vage
Copy link
Owner Author

Note: this PR includes breaking changes to how syntax highlighting styles are defined:

styles:
  code:
    style: zenburn
    inline_lang: python
    bg_override: "#aabbcc"

@d0c-s4vage d0c-s4vage merged commit b2b3d73 into 3.0-dev Dec 11, 2022
@d0c-s4vage d0c-s4vage deleted the feature-39-3.0_code_block_numbers_and_highlighting branch March 13, 2023 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant