Repository navigation
fix(notebooks): set name when creating from Markdown - #921
Merged
Merged
Conversation
Markdown create posted the file body as-is, so the first heading became cell content and data.attributes.name stayed empty. Add --name for Markdown create. When omitted, use the first ATX heading (any level). If there is no heading, leave the name empty as before. The Markdown API stores the name in YAML frontmatter title.
upsert_yaml_title trimmed each frontmatter line before looking for title:, so a nested mapping key or a title: line inside a block scalar was replaced instead of inserting a top-level title.
hippi345
marked this pull request as ready for review
October 17, 2026 16:22
platinummonkey
approved these changes
Oct 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Markdown notebook create now sets a notebook name instead of publishing with an empty name.
--nameis accepted onpup notebooks create --markdown; when it is omitted, the text of the first ATX heading (#–######, any level) is used. If there is no heading, the name is left empty, matching the previous Markdown create behavior.The Markdown path writes YAML frontmatter
title:(the same key pup's GET-markdown test fixture uses). Only a top-leveltitle:key is replaced; indented / nestedtitle:keys andtitle:lines inside a block scalar are left alone, and a top-leveltitle:is inserted instead.Motivation
Fixes #917.
pup notebooks create --markdown --file notebook.mdstored# Test notebookas cell content and leftdata.attributes.nameas"".API finding
Proven: The v1 JSON create endpoint (
POST /api/v1/notebooks) accepts a requireddata.attributes.name(NotebookCreateDataAttributes.name: Stringin the rust client pup pins). Markdown create does not use that JSON body; itPOSTstext/markdownto/api/unstable/notebooks.Proven in-repo:
get --markdownis documented as YAML frontmatter + body (docs/COMMANDS.md). The GET-markdown test mocks a server body of---\ntitle: test\n---\n\n## hi\n(src/commands/notebooks.rs,test_notebooks_get_markdown_requests_markdown_media_type). Pup does not parse that frontmatter; it prints the body as-is.Inferred, not proven: that POST
/api/unstable/notebookstreats YAMLtitle:asdata.attributes.name. There is no Datadog public spec for the unstable Markdown endpoint that says so, and this change was not live-round-tripped (no API credentials in this environment).Before / after
File:
# Test notebook Hello world!Before (
pup notebooks create --markdown --file notebook.md): posted body is the file as-is;pup notebooks get <id>shows"name": "".After (same command): posted body is:
--name "Incident notes"setstitle: "Incident notes"even when a heading is present. A file with no ATX heading is posted unchanged (empty name).Additional Notes
--namerequires--markdown(JSON create still takes the name from the request file).title:is updated.Checklist
Related Issues
Fixes #917
This change was prepared with AI assistance and reviewed by the author.