Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions documentation/docs/configuration/plugins/git-revision.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,26 @@ theme:
- revision.history
```

## Codeberg
### MkDocs projet in root directory
```yaml
repo_url: https://codeberg.org/exampleUser/exampleRepository
edit_url_template: _edit/main/docs/{path}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice to include the edit_url_template attribute even thoughmkdocs-terminal theme doesn't support it yet
thanks!


plugins:
- git-revision-date

theme:
name: terminal
features:
- revision.date
- revision.history
```

## Adding Repository Hosts
If your repository is not stored on GitHub or Bitbucket and you would like to use this feature please [submit a feature request] on GitHub.
If your repository is not stored on GitHub, Bitbucket, or Codeberg and you would like to use this feature please [submit a feature request] on GitHub.

You can further customize what revision information is included on the page by implementing your own `revision` template block. See [Blocks] for more information.

[submit a feature request]: https://github.com/ntno/mkdocs-terminal/issues/new/choose
[Blocks]: ../../blocks
[Blocks]: ../../blocks
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mkdocs-terminal",
"version": "4.6.0",
"version": "4.7.0",
"description": "Terminal.css theme for MkDocs",
"keywords": [
"mkdocs",
Expand Down
5 changes: 4 additions & 1 deletion terminal/partials/page-content/revision.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@
{%- if config.repo_name == "Bitbucket" -%}
See revision history on <a href="{{ page.edit_url | replace('mode=edit','mode=read') }}">{{ config.repo_name }}</a>.
{%- endif -%}
{%- if config.repo_name == "Codeberg" -%}
See revision history on <a href="{{ page.edit_url | replace('_edit','commits/branch') }}">{{ config.repo_name }}</a>.
{%- endif -%}
{%- endif -%}
</i>
</small>
</p>
</aside>
</section>
{%- endif -%}
{%- endif -%}
{%- endif -%}
2 changes: 1 addition & 1 deletion terminal/theme_version.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<meta name="generator" content="mkdocs-{{ mkdocs_version }}, mkdocs-terminal-4.6.0">
<meta name="generator" content="mkdocs-{{ mkdocs_version }}, mkdocs-terminal-4.7.0">
11 changes: 11 additions & 0 deletions tests/test_revision.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,17 @@ def test_bitbucket_history_link(self, revision_partial, enabled_context):
assert "<a href=\"" + expected_page_source_url + "\">Bitbucket</a>" in rendered_revision
assert_valid_html(rendered_revision)

def test_codeberg_history_link(self, revision_partial, enabled_context):
expected_page_history_url = "https://codeberg.org/myUsername/myRepository/commits/branch/main/docs/index.md"
enabled_context["page"]["meta"]["revision_date"] = "2023/03/04"
enabled_context["page"]["edit_url"] = "https://codeberg.org/myUsername/myRepository/_edit/main/docs/index.md"
enabled_context["config"]["repo_name"] = "Codeberg"
context_data = enabled_context
rendered_revision = revision_partial.render(context_data)
assert "Page last updated 2023/03/04. See revision history on" in rendered_revision
assert "<a href=\"" + expected_page_history_url + "\">Codeberg</a>" in rendered_revision
assert_valid_html(rendered_revision)

def test_last_updated_text_hidden_when_date_disabled_on_page(self, revision_partial, enabled_context):
enabled_context["page"]["meta"]["hide"] = [page_features.HIDE_REVISION_DATE_ON_PAGE]
context_data = enabled_context
Expand Down