Skip to content

Make hiredis jupyter example interactive#3306

Merged
paoloredis merged 7 commits into
mainfrom
DOC-6612
May 13, 2026
Merged

Make hiredis jupyter example interactive#3306
paoloredis merged 7 commits into
mainfrom
DOC-6612

Conversation

@paoloredis
Copy link
Copy Markdown
Collaborator

@paoloredis paoloredis commented May 12, 2026

Note

Medium Risk
Moderate risk because it changes the shared Thebe/CodeMirror initialization in baseof.html, including new dynamic loading of external CodeMirror mode code that could affect interactive code blocks site-wide.

Overview
Enables the hiredis (C) landing example to run as an interactive jupyter-example by adding the required KERNEL_NAME and %cflags directives in the C source and updating the guide to render it as a Thebe-backed snippet.

Updates the jupyter-example shortcode to preserve comment lines inside steps (so C magic comments aren’t dropped) and to emit the correct CodeMirror mode for C (text/x-csrc). Adds a matching Thebe workaround in baseof.html to lazily load CodeMirror’s C/clike mode and re-apply it to activated C cells so syntax highlighting remains intact.

Reviewed by Cursor Bugbot for commit 2b80a7d. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 2026

DOC-6612

@github-actions
Copy link
Copy Markdown
Contributor

@jit-ci
Copy link
Copy Markdown

jit-ci Bot commented May 12, 2026

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

Comment thread layouts/_default/baseof.html
Comment thread local_examples/client-specific/c/landing.c
Comment thread local_examples/client-specific/c/landing.c
@paoloredis
Copy link
Copy Markdown
Collaborator Author

paoloredis commented May 12, 2026

@andy-stark-redis Are you ok with having //%cflags:-lhiredis in the code block? It's needed to make it interactive

@andy-stark-redis
Copy link
Copy Markdown
Contributor

@andy-stark-redis Are you ok with having //%cflags:-lhiredis in the code block? It's needed to make it interactive

Can you place that line before the STEP_START? Or maybe add a comment above/below this line to say it's required for the interactive example? TBH, I don't think it's big problem even if you leave it exactly as it is - it's a comment, so it shouldn't do any harm even if someone does a copy/paste of the whole example.

Copy link
Copy Markdown
Contributor

@andy-stark-redis andy-stark-redis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most impressive one so far! Definitely approved :-)

@paoloredis
Copy link
Copy Markdown
Collaborator Author

paoloredis commented May 12, 2026

@andy-stark-redis It has to be after STEP_START because it has to be run like the rest of the code. Would you prefer something like this?

// The following comment is required to make the example interactive.
//%cflags:-lhiredis
#include <stdio.h>
#include <stdlib.h>

Yeah, it might be helpful to add it just to avoid the reader thinking it's required for hiredis generally.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fc03082. Configure here.

{{ if or (eq $trimmed "") (not (hasPrefix $trimmed $commentPrefix)) }}
{{ $currentSection = $currentSection | append . }}
{{ if $inCurrentStep }}
{{ $currentStepLines = $currentStepLines | append . }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment filter removal unintentionally changes all existing examples

Medium Severity

Removing the comment-only line filter here is a global change that affects all languages using this shortcode, not just C. For instance, the Python landing.py steps set_get_string and hash_operations contain comment-only lines like # True, # bar, and # {'surname': 'Smith', ...} that were intentionally stripped before rendering. These will now appear in the displayed step code on the live redis-py landing page. The fix could be scoped more narrowly (e.g., only preserving lines matching the //% directive pattern) rather than removing all comment filtering.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fc03082. Configure here.

@paoloredis paoloredis merged commit a493490 into main May 13, 2026
63 checks passed
@paoloredis paoloredis deleted the DOC-6612 branch May 13, 2026 12:07
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.

2 participants