Home > OS >  Git markdown not taken into account in gitlab? My commit message is displayed as plain text
Git markdown not taken into account in gitlab? My commit message is displayed as plain text

Time:03-04

I've prepared the commit file below, then committed it by a git commit -F commitMessage.md and pushed it to Gitlab, with the other files of the commit.

Apprentissage
# Informatique

   - Documents re-répartis pour permettre d'autres divisions
   - elk.md devient : `elk-01-installation-et-configuration`, `elk-02-elasticsearch`, `elk-03-logstash`, `elk-04-kibana`, `elk-05-filebeat-metricsbeat`.
 
# Mathématiques

   - Fonctions et applications >> `mathematiques-05-les-applications`

# Statistiques

   - Documents re-répartis pour permettre d'autres divisions
   - Les tests statistiques et hypothèses >> `statistiques_05-les-tests-statistiques-et-hypotheses`
   - hypothèses fortes et faibles (tests unilatéral ou bilatéral) >> `statistiques_05-les-tests-statistiques-et-hypotheses`
   - La comparaison d'échantillons (par moyenne) >> `statistiques_06-la-comparaison-echantillons`
   - Probabilités : passe du document 04 au `statistiques_40-les-probabilités`

# Territoire

   - Gestion des Milieux Aquatiques et Prévention des Inondations (GEMAPI) >> `territoire-13-environnement`
   - Union Européenne : opérations et programmes opérationnels >>  `territoire-14-UE-operations-po-fonds-européens`
   - Union Européenne : les fonds européens >>  `territoire-14-UE-operations-po-fonds-européens`
   - Union Européenne : les stratégies européennes >>  `territoire-15-UE-les-stratégies-européennes`

But Gitlab doesn't start the markdown conversion of that commit message. For example :

  • # starting lines aren't converted to headers
  • content under ticks ` don't see a special format applied to them.

enter image description here

A git config --list on my computer doesn't show something special (I didn't asked to replace # characters by something else for example).
And I don't think that my GitLab account is specially configured.

I must be facing something simple, but what is it?

CodePudding user response:

This simply isn't a feature of GitLab. Markdown files are rendered in GitLab's file viewer, but commit messages do not support any particularly special formatting.

Some content in commit messages, like MR/issue references (e.g. !123) and URLS may get hyperlinked in the UI, but that's about it as far as commit messages go.

It probably wouldn't be a practical feature to support markdown in commit messages, either. Commit messages are intended to be consumed/readable in many different platforms and tools, including git command line, various git gui software, all flavors of git servers, etc. Allowing markdown in one product could make it difficult to read commit messages in another tool. This has been a long-standing argument against such implementations.

As far as I know, there aren't really any git servers that support rendering markdown from commit messages.

As a possible alternative, you may consider something like what gitlab does with their changelog.md and git trailers (for the GitLab open source project itself).

  • Related