pawelsikora / mkdocs-git-show-history-log-plugin

MkDocs plugin for showing a history log for a specified markdown file
MIT License
3 stars 2 forks source link

Errors when splitting multi-lines commit messages #2

Open julienbeisel opened 2 years ago

julienbeisel commented 2 years ago

I tried to display multi-lines commit messages (by only taking the first line into account).

The line below does not work properly:

msg = commit.message.partition('\n')[0]

I think that every escape characters are not recognized and it results in an unstable result that breaks my markdown formatting.

The way to fix it is to use splitlines()

msg = commit.message.splitlines()[0]

I chose to display the first line, but it can also be possible to insert other lines with a regex or a join() on the array :

msg = "<br />".join(commit.message.splitlines())

pawelsikora commented 2 years ago

Hmm nice catch.

We can do both single/multi line, the question is why(do we/others need multiline really?) I would rather see the benefit of providing short sha with link do repo to view the full commit than to provide in the table more than one line (topic) - simply to make it clear and simple.

julienbeisel commented 2 years ago

In my case some users have a commits that contain multi lines messages, so I need to handle that case (the current version is buggy and totally breaks the formating).

sha can be an option. I think it could be great to pass parameters in the config file to set the headers.

For example

columns-to-display : ['author', 'message'] columns-to-display : ['date', 'author', 'sha']

julienbeisel commented 2 years ago

I can do a PR for that if you want.

Currently I host a fork of this project in a private Pypi but I would be happy to contribute :)

pawelsikora commented 2 years ago

@julienbeisel And I would be happy to have you as contributor, so just make a PR :)

pawelsikora commented 2 years ago

@julienbeisel multiline comments are naturall, this is not something I was talking about :)

We can do it, if you need it.

In case of parameters probably better to parse and for easy of use would be rather:

layout:

Would you mind to have a talk about some things via email? You can find mine in my profile.

Regards, Pawel