posit-dev / posit-dev/positron
Positron Notebooks - Support for `%%javascript` magic command
Open
Nobody has claimed this yet.
area: notebooks-jupyter
enhancement
theme: new notebook frontend
- Dominant language
- TypeScript
- Stars
- 4.3k
- Forks
- 184
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 195
Description
System details:
Positron and OS details:
Session details:
Python 3.13.5
Describe the issue:
In Jupyter, VS Code, and OLD notebooks, %%javascript magic commands used to work. In new notebooks, they don't work.
Steps to reproduce the issue:
- In a notebook with a Python kernel, attempt to run the following magic command in a cell.
%%javascript
const div = document.createElement('div');
div.style.cssText = `
width: 100px; height: 100px;
background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
border-radius: 50%; margin: 20px auto;
animation: pulse 2s infinite;
`;
div.innerHTML = '<div style="text-align:center;line-height:100px;color:white;font-weight:bold;">✨ Positron ✨</div>';
const style = document.createElement('style');
style.textContent = '@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.2); } }';
document.head.appendChild(style);
element.append(div);
- Notice that the output is an error about not being able to handle mime types.
Expected or desired behavior:
Javascript runs and pulsating circle with gradient coloring and message ('✨ Positron ✨') is displayed in the middle.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the %%javascript cell in a new notebook with a Python 3.13.5 kernel and inspect the MIME-type handling path that produces the reported error. Done means the JavaScript executes and the pulsating gradient Positron message is displayed in the notebook output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, jupyter-notebook, python, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100