Skip to content

Display git version & date to introduction section#551

Merged
bors[bot] merged 3 commits intomainfrom
feature/display-git-version-in-mdbook
Jul 28, 2021
Merged

Display git version & date to introduction section#551
bors[bot] merged 3 commits intomainfrom
feature/display-git-version-in-mdbook

Conversation

@justahero
Copy link
Copy Markdown

@justahero justahero commented Jul 28, 2021

This change is to know which specific commit of the book is published on the official site: https://defmt.ferrous-systems.com/

Note the sed command is written to work on OSX (the extra .bak parameter) and Unix systems, for some details check this SO discussion

  • add mdbook preprocessor to replace the version placeholder string with the used git version & date
  • add short section in the introduction to display version

Reference:

This is to learn which specific commit of the book is published on the official site: https://defmt.ferrous-systems.com/

* add mdbook preprocessor to replace the version placeholder string with
  the git version and date
* add short section in the introduction to display version

**Note** the `sed` command is written to be compatibly on OSX (the extra `.bak` command) and Unix systems, for some details check this SO discussion: https://stackoverflow.com/questions/4247068/sed-command-with-i-option-failing-on-mac-but-works-on-linux
@jonas-schievink
Copy link
Copy Markdown
Contributor

The deploy preview still shows the placeholder, did it not work?

@justahero
Copy link
Copy Markdown
Author

Yes, it seems the sed command failed in the preprocessor. Will check again and update accordingly.

Instead of find and replace the version via `sed`, the git version &
date are added to an empty `version.md` file that is included in the
introduction section of the book.
@justahero
Copy link
Copy Markdown
Author

The preview now displays used git hash and commit date.

@jonas-schievink
Copy link
Copy Markdown
Contributor

cool!

bors r+

@bors
Copy link
Copy Markdown
Contributor

bors Bot commented Jul 28, 2021

Build succeeded:

@bors bors Bot merged commit ed79843 into main Jul 28, 2021
@bors bors Bot deleted the feature/display-git-version-in-mdbook branch July 28, 2021 12:22
@Urhengulas
Copy link
Copy Markdown
Member

That's neat! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants