Page MenuHomePhorge

Support language highlighting for GitHub+StackOverflow+GitLab "Flavored Markdown" code blocks
Closed, ResolvedPublic

Description

This is a common styling hint for Markdown implementations, not supported in Remarkup (at the moment):

```php
$stuff = 1;
```

Remarkup only supports the language hint through the lang= parameter:

```lang=php
$stuff = 1;
```

It would be nice to understand Markdown language hint, because it looks similar and we can do that easily.


Some Markdown specifications:

https://github.github.com/gfm/#fenced-code-blocks

https://stackoverflow.com/editing-help#syntax-highlighting

https://docs.gitlab.com/ee/user/markdown.html#code-spans-and-blocks

As a side info to somehow understand influence, GitHub was born in 2007 (also Differential), Stack Overflow in 2008, Phabricator was released in 2010, and GitLab in 2011.

In Remarkup

IMPORTANT: For obvious reasons related to Remarkup, this can be a breaking change, since in Remarkup the text after the first backticks can be content. In Remarkup, the below example is a lang=text with 3 lines:
```php
cpp
python
```

In flavored markdown, the above is a lang=php with 2 lines (cpp and python)! See for example Stack Overflow, that eats the first line:

StackOverflow eating first line.png (542×453 px, 17 KB)

Our version must therefore be greatly sweetened.

As general indication we can say:

WARNING: Also before this Task, please AVOID to write content after the first backticks, or people cannot copy-paste your thing to GitLab or GitLab.

Event Timeline

valerio.bozzolan triaged this task as Low priority.
valerio.bozzolan created this object in space S1 Public.
valerio.bozzolan renamed this task from Support language highlighting for "GitHub Flavored Markdown" code blocks to Support language highlighting for GitHub+GitLab "Flavored Markdown" code blocks.Jun 20 2023, 07:05
valerio.bozzolan updated the task description. (Show Details)

Interestingly, Remarkup allowed too many things, so this Task cannot be 99.99999% safe.

We will keep support on this:


```var a = 1;
var b = 2;```

But if you want to make a code block mentioning two programming languages, please avoid to do so:


```php
cpp```

Instead, please adopt the canonical way:


```
php
cpp
```

valerio.bozzolan renamed this task from Support language highlighting for GitHub+GitLab "Flavored Markdown" code blocks to Support language highlighting for GitHub+GitLab+StackOverflow "Flavored Markdown" code blocks.Jun 25 2023, 09:18
valerio.bozzolan updated the task description. (Show Details)

Interestingly, it works ._.

Available for clarifications

valerio.bozzolan renamed this task from Support language highlighting for GitHub+GitLab+StackOverflow "Flavored Markdown" code blocks to Support language highlighting for GitHub+StackOverflow+GitLab "Flavored Markdown" code blocks.Jun 27 2023, 12:00
valerio.bozzolan updated the task description. (Show Details)