cooklang / cooklang/cookcli

Markdown output format introduces EOL characters mid text.

Open
#497 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.4k
Forks
109
Avg merge
1d 22h
Merged PRs (30d)
19

Description

Hi.

Current formatting of markdown creates potential unwanted artifacts when using markdown output in other applications.

Let’s take the `Neapolitan Pizzak.cook` example from the `seed`. Step 5 is written this way in cooklang:
```
Place the base on a lightly floured surface and spread @San Marzano tomato sauce{5%tbsp} on it. Add some fresh @basil leaves{} and fresh @mozzarella cheese{100%grams}.
```

When passing this through `cook recipe --format markdown`. It will generate:
```
5. Place the base on a lightly floured surface and spread San Marzano tomato
sauce on it. Add some fresh basil leaves and fresh mozzarella cheese.
```
As we can see, a EOL character has been introduced right after the word `tomato`

Depending on the markdown renderers that this text will be used in, it can produce different rendering issues.

I would recommend not to add a EOL character if the initial text does not have them.

Or else, based on the [CommonMark specs,](https://spec.commonmark.org/0.31.2/#list-items) for list items, if a paragraph of text in a list item is written over multiple lines, the text must have the same indentation. So step 5 should be written in Markdown like this:

```
5. Place the base on a lightly floured surface and spread San Marzano tomato
sauce on it. Add some fresh basil leaves and fresh mozzarella cheese.
```

Contributor guide

Open the contributing guide

Research direction

Locate the Markdown formatter used by `cook recipe --format markdown` and reproduce the output with the seeded `Neapolitan Pizzak.cook` example, especially step 5. Compare the generated line breaks with the source; done means text without source line breaks has no inserted mid-sentence EOL, or wrapped list lines use the indentation required by CommonMark.

Written by the indexing model from the issue text.

Assessment

Tech stack
markdown, rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.