craftcms / craftcms/docs

[API]: Add primary headings to Docs search responses

Open
#761 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
42
Forks
160
Avg merge
3h 9m
Merged PRs (30d)
4

Description

Product

Other/Multiple/Not Sure

Description

Documentation API search queries should include the top-level headings (often called the "table of contents" in Markdown parsers) with anchors and/or fully-formed direct URLs (as seen under the proposed headings key):

{
    "id": 826167,
    "title": "Application Configuration",
    "url": "https://craftcms.com/docs/5.x/reference/config/app",
    "uri": "docs/5.x/reference/config/app",
    "slug": "app",
    "type": "Craft CMS 5.x / Reference / Configuration Reference",
    "summaryPlain": "Craft’s entire application configuration can be customized via config/app.php. Any items returned by an app.php config file will get merged into the main application configuration array.",
    "summaryHtml": "Craft’s entire <a href=\"guide:structure-applications#application-configurations\">application configuration</a> can be customized via <code>config/app.php</code>. Any items returned by an <code>app.php</code> config file will get merged into the main application configuration array.",
    "headings": [
        { "level": 2, "name": "approach", "text": "Approach", "url": "https://craftcms.com/docs/5.x/reference/config/app#approach" },
        { "level": 2, "name": "requests-responses", "text": "Requests + Responses", "url": "https://craftcms.com/docs/5.x/reference/config/app#requests-responses" },
        { "level": 3, "name": "cors", "text": "CORS", "url": "https://craftcms.com/docs/5.x/reference/config/app#cors" }
    ]
}

We are currently testing the Heading Permalinks extension, and should be able to capture or generate all of this, as the text is rendered.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Documentation API search response and the rendered Markdown headings, then review the Heading Permalinks extension referenced in the issue. Done means search results include a headings array with heading levels, names, text, and anchored or fully formed direct URLs.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.