<feed xmlns='http://www.w3.org/2005/Atom'>
<title>cgit.git/filters/html-converters/md2html, branch main</title>
<subtitle>sl0p fork of cgit — readme-on-summary patch</subtitle>
<id>https://git.sl0p.foo/cgit.git/atom/filters/html-converters/md2html?h=main</id>
<link rel='self' href='https://git.sl0p.foo/cgit.git/atom/filters/html-converters/md2html?h=main'/>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/cgit.git/'/>
<updated>2026-07-18T20:58:15Z</updated>
<entry>
<title>md2html: auto-link bare repo paths in rendered markdown</title>
<updated>2026-07-18T20:58:15Z</updated>
<author>
<name>Jason A. Dönerfield</name>
<email>no-replay@sl0p.foo</email>
</author>
<published>2026-07-18T20:58:15Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/cgit.git/commit/?id=3f7db81172a25d8fe8637f1e0bca86d32caffe1e'/>
<id>urn:sha1:3f7db81172a25d8fe8637f1e0bca86d32caffe1e</id>
<content type='text'>
Detect path tokens in prose (must contain a "/") and inline &lt;code&gt; spans
(matched verbatim, so bare Makefile/README link too) and turn them into
links to the tree/ (or about/ for *.md) view — but ONLY when the token
resolves to a path that actually exists in the repo, which we learn from
`git ls-tree -r -t` at the default branch. &lt;pre&gt; code blocks, existing
&lt;a&gt; links (no nested anchors) and tag attributes are never touched;
tokens resolve relative to the rendered file dir or the repo root.
</content>
</entry>
<entry>
<title>md2html: do not loosen tight lists with multi-line items</title>
<updated>2026-07-18T19:31:00Z</updated>
<author>
<name>Jason A. Dönerfield</name>
<email>no-replay@sl0p.foo</email>
</author>
<published>2026-07-18T19:13:31Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/cgit.git/commit/?id=b9b2876ba7790b0e92e2c66f516d374ce7d53905'/>
<id>urn:sha1:b9b2876ba7790b0e92e2c66f516d374ce7d53905</id>
<content type='text'>
The list-interrupt preprocessor inserted a blank line before any bullet
that followed a non-item, non-4-space-indented line. When a list item
wrapped onto a 2-space-indented continuation line, the *next* item looked
like a paragraph-&gt;list transition, so a blank got injected between items
— turning a tight list into a loose one (every &lt;li&gt; wrapped in &lt;p&gt;), as
seen in docs/internals.md "Writing programs in C".

Track list state and only interrupt an actual paragraph: a bullet that
continues an already-open list (or its indented continuation lines) no
longer triggers a blank-line insert. The original paragraph-&gt;list
interrupt and the "1985." ordered-list guard are unchanged.
</content>
</entry>
<entry>
<title>md2html: render linked .md via the about view, fix relative base</title>
<updated>2026-07-18T19:31:00Z</updated>
<author>
<name>Jason A. Dönerfield</name>
<email>no-replay@sl0p.foo</email>
</author>
<published>2026-07-18T19:07:20Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/cgit.git/commit/?id=e3364e2c4424b373f80ac04d1ab2e3f3d82328e1'/>
<id>urn:sha1:e3364e2c4424b373f80ac04d1ab2e3f3d82328e1</id>
<content type='text'>
Links to markdown files now point at /&lt;repo&gt;/about/&lt;path&gt; (rendered
through the about-filter) instead of /&lt;repo&gt;/tree/&lt;path&gt; (raw blob), so
clicking a README link to another .md shows rendered markdown.

Also resolve relative links against the rendered file's own directory:
about-formatting.sh now forwards the filename cgit passes ($1) to
md2html as argv[1], and md2html uses dirname(argv[1]) as the base. This
makes links *inside* a rendered subpage (docs/foo.md -&gt; ./bar.md,
../README.md, images) resolve correctly. Non-markdown files and
directories still go to tree/; images to plain/; about/ links carry no
?h= since the about view renders against the configured readme ref.
</content>
</entry>
<entry>
<title>md2html: rewrite relative README links to the tree/ blob URL</title>
<updated>2026-07-18T19:31:00Z</updated>
<author>
<name>Jason A. Dönerfield</name>
<email>no-replay@sl0p.foo</email>
</author>
<published>2026-07-18T18:50:31Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/cgit.git/commit/?id=1be367f87b22ae4f43e68dd3ef600e1ee4b30c44'/>
<id>urn:sha1:1be367f87b22ae4f43e68dd3ef600e1ee4b30c44</id>
<content type='text'>
The image-rewrite patch only fixed relative &lt;img src&gt;; relative &lt;a href&gt;
links (e.g. [docs/x.md](docs/x.md)) were still resolved by the browser
against the about/summary page URL, not the repo root, so they 404d.

Rewrite relative &lt;a href&gt; to absolute cgit URLs the same way:
  in-repo path -&gt; /&lt;repo&gt;/tree/&lt;path&gt;?h=&lt;branch&gt;
  ../sibling   -&gt; resolved against the repo URL location (/&lt;sibling&gt;)
Fragments are preserved; anchors, absolute, scheme and query-only URLs
are left untouched.
</content>
</entry>
<entry>
<title>md2html: let bullet/1. lists interrupt paragraphs (GitHub-style)</title>
<updated>2026-07-18T19:31:00Z</updated>
<author>
<name>Jason A. Dönerfield</name>
<email>no-replay@sl0p.foo</email>
</author>
<published>2026-07-16T22:38:46Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/cgit.git/commit/?id=f736dbeb318386b1292bf00d0199bc3771d849f7'/>
<id>urn:sha1:f736dbeb318386b1292bf00d0199bc3771d849f7</id>
<content type='text'>
Python-Markdown, unlike CommonMark/GitHub, refuses to start a list that
immediately follows a paragraph line without an intervening blank line, so a
very common README shape renders as one run-on paragraph:

    Passing:
    - foo
    - bar

Add a preprocessor that inserts the blank line when a bullet (- * +) or a
1./1) ordered marker follows a paragraph line, restoring GitHub behavior.
Only '1' interrupts for ordered lists (matching CommonMark) so prose like
'... the year\n1985. was ...' is not turned into a list. Fenced/indented
code and lines already inside a list are left untouched.
</content>
</entry>
<entry>
<title>md2html: rewrite relative image links to the plain/ blob URL</title>
<updated>2026-07-15T14:13:14Z</updated>
<author>
<name>Jason A. Dönerfield</name>
<email>no-replay@sl0p.foo</email>
</author>
<published>2026-07-15T14:13:14Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/cgit.git/commit/?id=d191bab7341da2242c7d0be92fa01465e64757f2'/>
<id>urn:sha1:d191bab7341da2242c7d0be92fa01465e64757f2</id>
<content type='text'>
A README's relative image paths (screenshots/foo.png) are repo blobs that
cgit only serves via its plain command, but a browser resolves a relative
&lt;img src&gt; against the about-page URL, so the image 404s. Rewrite relative
&lt;img src&gt; to an absolute /&lt;repo&gt;/plain/&lt;path&gt;?h=&lt;branch&gt; URL using the
CGIT_REPO_URL / CGIT_REPO_DEFBRANCH environment cgit gives the about-filter.
Absolute so it also works with ui-summary readme rendering.
</content>
</entry>
<entry>
<title>md2html: use proper formatting for hr</title>
<updated>2021-05-12T13:32:50Z</updated>
<author>
<name>Christian Hesse</name>
<email>mail@eworm.de</email>
</author>
<published>2020-03-31T12:53:42Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/cgit.git/commit/?id=62eb8db4527e6803df4a26056db8ab9eaf5a79ba'/>
<id>urn:sha1:62eb8db4527e6803df4a26056db8ab9eaf5a79ba</id>
<content type='text'>
This addressed a non-existent background image and made the element
invisible. Drop the style and use something sane.

Signed-off-by: Christian Hesse &lt;mail@eworm.de&gt;
</content>
</entry>
<entry>
<title>md2html: use sane_lists extension</title>
<updated>2020-12-29T11:33:48Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2020-12-04T12:13:23Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/cgit.git/commit/?id=f69626c68eb64e1a2f6b4ba055409d7205e72757'/>
<id>urn:sha1:f69626c68eb64e1a2f6b4ba055409d7205e72757</id>
<content type='text'>
This allows for cleaner nesting semantics and matches github more
closely.

Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>filters: generate anchor links from markdown</title>
<updated>2018-08-28T12:37:19Z</updated>
<author>
<name>Christian Hesse</name>
<email>mail@eworm.de</email>
</author>
<published>2018-07-13T19:44:50Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/cgit.git/commit/?id=b0fc647fe61c19338aec65ffcab513cc84599b18'/>
<id>urn:sha1:b0fc647fe61c19338aec65ffcab513cc84599b18</id>
<content type='text'>
This makes the markdown filter generate anchor links for headings.

Signed-off-by: Christian Hesse &lt;mail@eworm.de&gt;
Tested-by: jean-christophe manciot &lt;actionmystique@gmail.com&gt;
</content>
</entry>
<entry>
<title>md2html: use utf-8 and flush output buffer</title>
<updated>2016-06-17T10:28:03Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2016-06-17T10:27:10Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/cgit.git/commit/?id=7d51120440346108aad74f007431ad65b307f6d7'/>
<id>urn:sha1:7d51120440346108aad74f007431ad65b307f6d7</id>
<content type='text'>
Otherwise we get the classic Python UTF-8 errors, and the text is all
out of order. While we're at it, switch to python3 so we only have to
support one set of oddball semantics.

Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
Suggested-by: Daniel Campbell &lt;dlcampbell@gmx.com&gt;
</content>
</entry>
</feed>
