# Feature COMMS-1134 - Markdown rendering for work packages

Project: Stream Communicator
Status: tested
URL: https://community.openproject.org/work_packages/COMMS-1134

## Planning

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Target versions | 18.0.0 |
| Sprint |  |
| Backlog bucket |  |
| Votes | 3 |
| List |  |
| Roadmap |  |
| Relevance |  |

## OPEN POINTS / FEEDBACK

_No work packages_

## Use cases

_No work packages_

## Features and Chunks

_No work packages_

## Bugs and other work packages

| ID | Type | Subject | Status | Assignee | Target versions | Spent time | Module |
| --- | --- | --- | --- | --- | --- | --- | --- |
| COMMS-1147 | Bug | Markdown for work packages: date and time field is showing -1 hour | confirmed |  |  |  | Modules and project features / Work packages |

## Technical Details

| Attribute | Value |
| --- | --- |
| Module | Modules and project features / Work packages, Modules and project features / Export |
| Feature Flag |  |
| Requires doc change | Yes |
| Enterprise plan | Community (COM) |

## Details

| Attribute | Value |
| --- | --- |
| Pull preview |  |
| Mockups |  |
| Accessibility | No |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Feature Lead |  |
| Developers | Alexander Coles |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| PD (min) |  |
| PD (max) |  |
| Work |  |
| Labor costs |  |

## Description

Markdown has become the language of AI, and Rails has embraced this adoption by making it easier to [respond to markdown requests and render them directly](https://guides.rubyonrails.org/8_1_release_notes.html#markdown-rendering).

We could render the work package description directly as markdown on a new route (e.g. `/wp/<ID>.md`), so bots can use this instead of needing to request and parse the whole HTML page.

### Acceptance criteria

Items marked \* need custom request headers, so a browser cannot check them: QA'able by a developer (e.g. `curl`), or by asking Claude/an LLM to fetch the page with an API key.

#### **Access**

1.  Signed in, opening `/wp/<ID>.md` (e.g. `/wp/SE-642.md`) shows the work package as plain Markdown text in the browser; `/work_packages/<ID>.md` and `/projects/<project>/work_packages/<ID>.md` show the same document.

2.  \* Requesting `/work_packages/<ID>` with the header `Accept: text/markdown` returns the same Markdown document.

3.  The work package **More** menu (and the table/card context menu) has a **View Markdown** entry next to **Generate PDF** that opens the Markdown document.

4.  \* A request with a valid `X-OpenProject-API-Key` header and no browser session returns the Markdown document.

5.  A request without a session or API key returns 401 with a short Markdown hint, not a blank page or an HTML login page.

6.  A user who cannot see the work package gets a not-found response, the same as for the HTML page.

7.  \* The API v3 work package response contains a `_links.markdown` link to the document. 

#### **Content**

1.  The document starts with `# <Type> <ID> - <Subject>`, then project, status and the work package URL.

2.  Attribute groups appear in the same order and with the same headings as the work package page (Form configuration); groups that are hidden or empty on the page are not shown.

3.  Attributes are shown as two-column tables; long-text custom fields appear as their own sub-heading with their Markdown content.

4.  Embedded related work package tables (e.g. children) appear as tables with the query's columns and only the work packages the user can see.

5.  In those tables, attributes the user may not view on a related work package (e.g. budget, project phase, a parent in a project the user cannot see) are left blank.

6.  Dates are ISO formatted (`2026-10-01`); the combined Date attribute shows `start – due`; booleans show Yes/No; hours, percentages and costs show their units.

7.  The description comes last under `## Description`, as raw Markdown.

8.  Attribute macros in the description (e.g. `workPackageValue:subject`) are replaced by their values.

9.  Task lists in the description stay as `- [ ]` / `- [x]` (not escaped), also when the description contains a macro or a `#ID` reference.

10. Wiki links in the description (`[[Page]]`, `[[Page|title]]`) become Markdown links to the wiki page.

11. Headings and labels follow the user's language.

### **Hints for QA**

This FEATURE requires some changes to existing PDF generation code. If time-permits, please do a brief smoke test of PDF Exporter functionality checking that:

  - **Generate PDF** still produces the same groups as before; attributes of disabled modules and groups with only hidden attributes no longer appear.

  - In a PDF, task lists in a description containing a macro render as check boxes, and wiki links render as links.
