MkCommitConventions¶
Text node containing Commit message conventions.¶
Example: All commit_types
Jinja
{{ mk.MkCommitConventions() }}
Python
MkCommitConventions()
Commit messages must follow the following convention:
<type>[(scope)]: Subject
[Body]
Subject and body must be valid Markdown. Subject must have proper casing (uppercase for first letter if it makes sense), but no dot at the end, and no punctuation in general.
Scope and body are optional. Type can be:
build: About packaging, building wheels, etc.chore: About packaging or repo/files management.docs: About documentation.feat: New feature.fix: Bug fix.refactor: Changes that are not features or bug fixes.test: About tests.
If you write a body, please add trailers at the end (for example issues and PR references, or co-authors), without relying on GitHub’s flavored Markdown:
Body.
Issue #10: https://github.com/namespace/project/issues/10
Related to PR namespace/other-project#2: https://github.com/namespace/other-project/pull/2"
These “trailers” must appear at the end of the body,
without any blank lines between them. The trailer title
can contain any character except colons :.
We expect a full URI for each trailer, not just GitHub autolinks
(for example, full GitHub URLs for commits and issues,
not the hash or the #issue-number).
We do not enforce a line length on commit messages summary and body, but please avoid very long summaries, and very long lines in the body, unless they are part of code blocks that must not be wrapped.
Commit messages must follow the following convention:
```md
<type>[(scope)]: Subject
[Body]
```
**Subject and body must be valid Markdown.**
Subject must have proper casing (uppercase for first letter
if it makes sense), but no dot at the end, and no punctuation
in general.
Scope and body are optional. Type can be:
* `build`: About packaging, building wheels, etc.
* `chore`: About packaging or repo/files management.
* `ci`: About Continuous Integration.
* `deps`: Dependencies update.
* `doc`: About documentation.
* `docs`: About documentation.
* `feat`: New feature.
* `fix`: Bug fix.
* `ref`: Code refactoring.
* `revert`: Code revert.
* `perf`: About performance.
* `refactor`: Changes that are not features or bug fixes.
* `style`: A change in code style/format.
* `test`: About tests.
* `tests`: About tests.
If you write a body, please add trailers at the end
(for example issues and PR references, or co-authors),
without relying on GitHub's flavored Markdown:
```md
Body.
Issue #10: https://github.com/namespace/project/issues/10
Related to PR namespace/other-project#2: https://github.com/namespace/other-project/pull/2"
```
These "trailers" must appear at the end of the body,
without any blank lines between them. The trailer title
can contain any character except colons `:`.
We expect a full URI for each trailer, not just GitHub autolinks
(for example, full GitHub URLs for commits and issues,
not the hash or the #issue-number).
We do not enforce a line length on commit messages summary and body,
but please avoid very long summaries, and very long lines in the body,
unless they are part of code blocks that must not be wrapped.
<p>Commit messages must follow the following convention:</p>
<pre><code class="language-md"><type>[(scope)]: Subject
[Body]
</code></pre>
<p><strong>Subject and body must be valid Markdown.</strong>
Subject must have proper casing (uppercase for first letter
if it makes sense), but no dot at the end, and no punctuation
in general.</p>
<p>Scope and body are optional. Type can be:</p>
<ul>
<li><code>build</code>: About packaging, building wheels, etc.</li>
<li><code>chore</code>: About packaging or repo/files management.</li>
<li><code>ci</code>: About Continuous Integration.</li>
<li><code>deps</code>: Dependencies update.</li>
<li><code>doc</code>: About documentation.</li>
<li><code>docs</code>: About documentation.</li>
<li><code>feat</code>: New feature.</li>
<li><code>fix</code>: Bug fix.</li>
<li><code>ref</code>: Code refactoring.</li>
<li><code>revert</code>: Code revert.</li>
<li><code>perf</code>: About performance.</li>
<li><code>refactor</code>: Changes that are not features or bug fixes.</li>
<li><code>style</code>: A change in code style/format.</li>
<li><code>test</code>: About tests.</li>
<li><code>tests</code>: About tests.</li>
</ul>
<p>If you write a body, please add trailers at the end
(for example issues and PR references, or co-authors),
without relying on GitHub's flavored Markdown:</p>
<pre><code class="language-md">Body.
Issue #10: https://github.com/namespace/project/issues/10
Related to PR namespace/other-project#2: https://github.com/namespace/other-project/pull/2"
</code></pre>
<p>These "trailers" must appear at the end of the body,
without any blank lines between them. The trailer title
can contain any character except colons <code>:</code>.
We expect a full URI for each trailer, not just GitHub autolinks
(for example, full GitHub URLs for commits and issues,
not the hash or the #issue-number).</p>
<p>We do not enforce a line length on commit messages summary and body,
but please avoid very long summaries, and very long lines in the body,
unless they are part of code blocks that must not be wrapped.</p>
Example: Selected commit types
Jinja
{{ ["fix", "feat", "refactor"] | MkCommitConventions }}
Python
MkCommitConventions(['fix', 'feat', 'refactor'])
Commit messages must follow the following convention:
<type>[(scope)]: Subject
[Body]
Subject and body must be valid Markdown. Subject must have proper casing (uppercase for first letter if it makes sense), but no dot at the end, and no punctuation in general.
Scope and body are optional. Type can be:
feat: New feature.fix: Bug fix.refactor: Changes that are not features or bug fixes.
If you write a body, please add trailers at the end (for example issues and PR references, or co-authors), without relying on GitHub’s flavored Markdown:
Body.
Issue #10: https://github.com/namespace/project/issues/10
Related to PR namespace/other-project#2: https://github.com/namespace/other-project/pull/2"
These “trailers” must appear at the end of the body,
without any blank lines between them. The trailer title
can contain any character except colons :.
We expect a full URI for each trailer, not just GitHub autolinks
(for example, full GitHub URLs for commits and issues,
not the hash or the #issue-number).
We do not enforce a line length on commit messages summary and body, but please avoid very long summaries, and very long lines in the body, unless they are part of code blocks that must not be wrapped.
Commit messages must follow the following convention:
```md
<type>[(scope)]: Subject
[Body]
```
**Subject and body must be valid Markdown.**
Subject must have proper casing (uppercase for first letter
if it makes sense), but no dot at the end, and no punctuation
in general.
Scope and body are optional. Type can be:
* `feat`: New feature.
* `fix`: Bug fix.
* `refactor`: Changes that are not features or bug fixes.
If you write a body, please add trailers at the end
(for example issues and PR references, or co-authors),
without relying on GitHub's flavored Markdown:
```md
Body.
Issue #10: https://github.com/namespace/project/issues/10
Related to PR namespace/other-project#2: https://github.com/namespace/other-project/pull/2"
```
These "trailers" must appear at the end of the body,
without any blank lines between them. The trailer title
can contain any character except colons `:`.
We expect a full URI for each trailer, not just GitHub autolinks
(for example, full GitHub URLs for commits and issues,
not the hash or the #issue-number).
We do not enforce a line length on commit messages summary and body,
but please avoid very long summaries, and very long lines in the body,
unless they are part of code blocks that must not be wrapped.
<p>Commit messages must follow the following convention:</p>
<pre><code class="language-md"><type>[(scope)]: Subject
[Body]
</code></pre>
<p><strong>Subject and body must be valid Markdown.</strong>
Subject must have proper casing (uppercase for first letter
if it makes sense), but no dot at the end, and no punctuation
in general.</p>
<p>Scope and body are optional. Type can be:</p>
<ul>
<li><code>feat</code>: New feature.</li>
<li><code>fix</code>: Bug fix.</li>
<li><code>refactor</code>: Changes that are not features or bug fixes.</li>
</ul>
<p>If you write a body, please add trailers at the end
(for example issues and PR references, or co-authors),
without relying on GitHub's flavored Markdown:</p>
<pre><code class="language-md">Body.
Issue #10: https://github.com/namespace/project/issues/10
Related to PR namespace/other-project#2: https://github.com/namespace/other-project/pull/2"
</code></pre>
<p>These "trailers" must appear at the end of the body,
without any blank lines between them. The trailer title
can contain any character except colons <code>:</code>.
We expect a full URI for each trailer, not just GitHub autolinks
(for example, full GitHub URLs for commits and issues,
not the hash or the #issue-number).</p>
<p>We do not enforce a line length on commit messages summary and body,
but please avoid very long summaries, and very long lines in the body,
unless they are part of code blocks that must not be wrapped.</p>
Name |
Children |
Inherits |
|---|---|---|
MkTemplate |
graph TD
3868777977["mkcommitconventions.MkCommitConventions"]
1289759389["mktemplate.MkTemplate"]
3160803176["rendercache.TemplateRenderMixin"]
2751680898["builtins.object"]
835538629["mkcontainer.MkContainer"]
1956333208["mkcontainer.MkContainerBase"]
1359323199["mknode.MkNode"]
1289759389 --> 3868777977
3160803176 --> 1289759389
2751680898 --> 3160803176
835538629 --> 1289759389
1956333208 --> 835538629
1359323199 --> 1956333208
2751680898 --> 1359323199
[metadata]
icon = "simple-icons:conventionalcommits"
status = "new"
name = "MkCommitConventions"
virtual_children = true
[examples.regular]
title = "All commit_types"
jinja = """
{{ mk.MkCommitConventions() }}
"""
[examples.explicit]
title = "Selected commit types"
jinja = """
{{ ["fix", "feat", "refactor"] | MkCommitConventions }}
"""
[output.markdown]
template = """
Commit messages must follow the following convention:
```md
<type>[(scope)]: Subject
[Body]
```
**Subject and body must be valid Markdown.**
Subject must have proper casing (uppercase for first letter
if it makes sense), but no dot at the end, and no punctuation
in general.
Scope and body are optional. Type can be:
{% for commit_type in node.commit_types %}
* `{{ commit_type.typ }}`: {{ commit_type.description }}
{% endfor %}
If you write a body, please add trailers at the end
(for example issues and PR references, or co-authors),
without relying on GitHub's flavored Markdown:
```md
Body.
Issue #10: https://github.com/namespace/project/issues/10
Related to PR namespace/other-project#2: https://github.com/namespace/other-project/pull/2"
```
These "trailers" must appear at the end of the body,
without any blank lines between them. The trailer title
can contain any character except colons `:`.
We expect a full URI for each trailer, not just GitHub autolinks
(for example, full GitHub URLs for commits and issues,
not the hash or the #issue-number).
We do not enforce a line length on commit messages summary and body,
but please avoid very long summaries, and very long lines in the body,
unless they are part of code blocks that must not be wrapped.
"""
11class MkCommitConventions(mktemplate.MkTemplate):
12 """Text node containing Commit message conventions."""
13
14 ICON = "simple/conventionalcommits"
15 STATUS = "new"
16
17 def __init__(
18 self,
19 commit_types: (
20 list[commitconventions.CommitTypeStr] | commitconventions.ConventionTypeStr | None
21 ) = None,
22 **kwargs: Any,
23 ) -> None:
24 """Constructor.
25
26 Args:
27 commit_types: Allowed commit commit_types. Can be "basic",
28 "conventional_commits", or a list of commit_types
29 kwargs: Keyword arguments passed to parent
30 """
31 super().__init__(template="output/markdown/template", **kwargs)
32 self._commit_types = commit_types
33
34 @property
35 def commit_types(self) -> list[commitconventions.CommitType]:
36 val: list[commitconventions.CommitTypeStr] | commitconventions.ConventionTypeStr
37 match self._commit_types:
38 case None:
39 val = self.ctx.metadata.commit_types or "conventional_commits"
40 case _:
41 val = self._commit_types
42 return commitconventions.get_types(val)
Page info
Code for this page
93def create_section_for_nodes(
94 nav: mk.MkNav,
95 klasses: Sequence[type[mk.MkNode]],
96) -> mk.MkTable:
97 table = mk.MkTable(columns=["Node", "Docstrings", "Markdown extensions"])
98 for kls in klasses:
99 tpl = "classpage_custom.jinja"
100 page = mk.MkClassPage(kls, icon=kls.ICON, template_path=tpl, parent=nav, hide="toc")
101 nav += page
102 if kls.STATUS:
103 page.metadata.status = kls.STATUS
104 elif kls.JS_FILES:
105 page.metadata.status = "js"
106 elif kls.CSS:
107 page.metadata.status = "css"
108 page.created_by = create_section_for_nodes
109 link = mk.MkLink(page, kls.__name__, icon=kls.ICON)
110 extensions = ", ".join(f"`{i}`" for i in kls.REQUIRED_EXTENSIONS)
111 table.add_row((link, kls.__doc__, extensions))
112 return table
Resources
Resources(css=[],
markdown_extensions={'admonition': {},
'pymdownx.details': {},
'pymdownx.highlight': {'anchor_linenums': True,
'line_spans': '__span',
'pygments_lang_class': True},
'pymdownx.superfences': {'custom_fences': [{'class': 'mermaid',
'format': <function fence_code_format at 0x7ff77e88b060>,
'name': 'mermaid'}]},
'pymdownx.tabbed': {},
'tables': {}},
plugins=[Plugin('mkdocstrings')],
js=[],
assets=[],
packages=[])
Metadata
created:
source_filename: /home/runner/work/mknodes/mknodes/src/mknodes/manual/nodes_section.py
source_function: create_section_for_nodes
source_line_no: 93
hide:
- toc
icon: simple/conventionalcommits
status: new
title: MkCommitConventions