Skip to content

fix(field-suggestions): opt-in inline values from fenced code blocks#1128

Merged
chhoumann merged 3 commits intomasterfrom
998-bug-quickadd-api-getfieldvalues-does-not-work-with-dataview-fields-in-code-blocks-1
Feb 28, 2026
Merged

fix(field-suggestions): opt-in inline values from fenced code blocks#1128
chhoumann merged 3 commits intomasterfrom
998-bug-quickadd-api-getfieldvalues-does-not-work-with-dataview-fields-in-code-blocks-1

Conversation

@chhoumann
Copy link
Owner

@chhoumann chhoumann commented Feb 28, 2026

Adds an opt-in path to include inline field:: value pairs from selected fenced code block types when collecting field suggestions.

QuickAdd currently strips inline fields inside fenced blocks to avoid false positives, which means use cases like ad-note blocks cannot be queried via fieldSuggestions.getFieldValues or {{FIELD:...|inline:true}}. This change keeps the existing default behavior and only includes fenced-block values when explicitly allowlisted.

I considered changing includeInline: true to scan all fenced blocks, but rejected it because it would introduce broad regressions for users with real code blocks that contain :: patterns.

Reviewer focus and risk notes:

  • New API option: includeInlineCodeBlocks?: string[] (only active when includeInline is true)
  • New FIELD filter: inline-code-blocks:<csv>
  • Cache key now includes inlineCodeBlocks so differing allowlists do not share stale results
  • Default behavior is unchanged unless opt-in is provided

Validation performed:

  • bun run test
  • bun run build-with-lint
  • Obsidian CLI repro in vault=dev after plugin reload:
    • baseline (includeInline: true) => ["343434"]
    • allowlisted (includeInlineCodeBlocks: ["ad-note"]) => ["121212", "343434"]

Fixes #998


Open with Devin

Summary by CodeRabbit

  • New Features

    • Allowlist-based inclusion of inline field values from specific fenced code block types via a new inline-code-blocks filter and API option.
  • Documentation

    • Updated Format Syntax and QuickAdd API docs with examples showing how to include inline fields from allowlisted code blocks.
  • Tests

    • Added tests covering inline field extraction and code-block allowlisting behavior.

@vercel
Copy link

vercel bot commented Feb 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
quickadd Ready Ready Preview Feb 28, 2026 1:07pm

@coderabbitai
Copy link

coderabbitai bot commented Feb 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ef155be and b967541.

📒 Files selected for processing (2)
  • src/utils/InlineFieldParser.test.ts
  • src/utils/InlineFieldParser.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/utils/InlineFieldParser.ts
  • src/utils/InlineFieldParser.test.ts

📝 Walkthrough

Walkthrough

This PR adds support for selectively including inline fields found inside specific fenced code block types by introducing an includeInlineCodeBlocks option and corresponding parsing, propagation, and tests to allowlisting code block types (e.g., ad-note) when collecting inline field values.

Changes

Cohort / File(s) Summary
Documentation
docs/docs/FormatSyntax.md, docs/docs/QuickAddAPI.md
Documented new inline-code-blocks filter syntax and includeInlineCodeBlocks option with examples showing inclusion of inline fields from allowlisted fenced code block types.
Format Syntax Constants
src/constants.ts
Added a new FORMAT_SYNTAX variant demonstrating `inline:true
Filter Parsing
src/utils/FieldSuggestionParser.ts, src/utils/FieldSuggestionParser.test.ts
Added inlineCodeBlocks?: string[] to FieldFilter and parsing logic/tests to parse comma-separated inline-code-blocks allowlists (trim/lowercase/filter empties).
QuickAdd API & Field Collection
src/quickAddApi.ts, src/quickAddApi.fieldSuggestions.test.ts, src/utils/FieldValueCollector.ts, src/utils/FieldValueCollector.issue671.test.ts
Extended getFieldValues options with includeInlineCodeBlocks?: string[], normalized and propagated allowlists into filters and downstream calls; added tests verifying default exclusion, allowlist inclusion, and behavior with includeInline toggled.
Inline Field Parsing
src/utils/InlineFieldParser.ts, src/utils/InlineFieldParser.test.ts
Refactored parsing to accept includeCodeBlocks option; added regex-based frontmatter, fenced block, and inline span handling; implemented filterFencedCodeBlocks to selectively retain allowlisted fenced blocks; expanded tests for various fenced block scenarios.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client Code
    participant QA as QuickAddApi
    participant FVC as FieldValueCollector
    participant FSP as FieldSuggestionParser
    participant IFP as InlineFieldParser

    Client->>QA: getFieldValues(fieldName, {includeInlineCodeBlocks: ["ad-note"]})
    QA->>FSP: parse field filters (inline:true|inline-code-blocks:ad-note)
    FSP-->>QA: FieldFilter {inline: true, inlineCodeBlocks: ["ad-note"]}
    QA->>FVC: collectFieldValuesManually(fieldName, filters)
    FVC->>IFP: getFieldValues(content, fieldName, {includeCodeBlocks: ["ad-note"]})
    IFP->>IFP: parseInlineFields(content, {includeCodeBlocks: ["ad-note"]})
    Note over IFP: filterFencedCodeBlocks() keeps only "ad-note" blocks
    IFP-->>FVC: Set with field values from ad-note blocks
    FVC-->>QA: aggregated field values
    QA-->>Client: ["121212","343434"]
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

released

Poem

🐰 Through fenced blocks I leap and peep,
I sniff the fields where secrets sleep,
Allowlist set to ad-note true,
I pull the IDs and share with you,
A hopping patch — concise and neat!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding opt-in support for including inline field values from fenced code blocks, which is the core objective of this PR.
Linked Issues check ✅ Passed The PR fully addresses issue #998 by implementing the requested opt-in mechanism to search for inline fields in allowlisted fenced code block types via the new includeInlineCodeBlocks option.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing the inline field extraction from fenced code blocks feature; no unrelated modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 998-bug-quickadd-api-getfieldvalues-does-not-work-with-dataview-fields-in-code-blocks-1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 28, 2026

Deploying quickadd with  Cloudflare Pages  Cloudflare Pages

Latest commit: b967541
Status: ✅  Deploy successful!
Preview URL: https://535df6d6.quickadd.pages.dev
Branch Preview URL: https://998-bug-quickadd-api-getfiel-oo1g.quickadd.pages.dev

View logs

@chhoumann chhoumann marked this pull request as ready for review February 28, 2026 13:00
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 6 additional findings.

Open in Devin Review

@chhoumann chhoumann merged commit 8597905 into master Feb 28, 2026
5 checks passed
@chhoumann chhoumann deleted the 998-bug-quickadd-api-getfieldvalues-does-not-work-with-dataview-fields-in-code-blocks-1 branch February 28, 2026 13:10
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.

[BUG] QuickAdd API getFieldValues() does not work with DataView fields in code blocks

1 participant