Monorepo for Tangled โ€” https://tangled.org

markdown admonishment support #132

closed
opened by isabelroses.com

looks like

> [!NOTE]
> my note

i think this patch would work

From dea1a8fef266ca6a1c77762ff18caa72a4a5ca92 Mon Sep 17 00:00:00 2001
From: isabel <isabel@isabelroses.com>
Date: Wed, 9 Jul 2025 15:31:30 +0100
Subject: [PATCH] feat(markdown): add admonishment supports

---
 appview/pages/markup/markdown.go | 3 ++-
 flake.nix                        | 2 +-
 go.mod                           | 1 +
 go.sum                           | 2 ++
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/appview/pages/markup/markdown.go b/appview/pages/markup/markdown.go
index df4afa5..e8c1638 100644
--- a/appview/pages/markup/markdown.go
+++ b/appview/pages/markup/markdown.go
@@ -17,6 +17,7 @@ import (
        "github.com/yuin/goldmark/renderer/html"
        "github.com/yuin/goldmark/text"
        "github.com/yuin/goldmark/util"
+       callouts "gitlab.com/staticnoise/goldmark-callout"
        htmlparse "golang.org/x/net/html"

        "tangled.sh/tangled.sh/core/appview/pages/repoinfo"
@@ -44,7 +45,7 @@ type RenderContext struct {

 func (rctx *RenderContext) RenderMarkdown(source string) string {
        md := goldmark.New(
-               goldmark.WithExtensions(extension.GFM),
+               goldmark.WithExtensions(extension.GFM, callouts.CalloutExtention),
                goldmark.WithParserOptions(
                        parser.WithAutoHeadingID(),
                ),
diff --git a/flake.nix b/flake.nix
index c5d06ac..02befe5 100644
--- a/flake.nix
+++ b/flake.nix
@@ -61,7 +61,7 @@
     inherit (gitignore.lib) gitignoreSource;
   in {
     overlays.default = final: prev: let
-      goModHash = "sha256-2RUwj16RNaZ/gCOcd7b3LRCHiROCRj9HuzbBdLdgWGo=";
+      goModHash = "sha256-J17cNjjuY1kF7uz4FezlV7ou3w8j1U9EoZ+OUuZhujM=";
       appviewDeps = {
         inherit htmx-src htmx-ws-src lucide-src inter-fonts-src ibm-plex-mono-src goModHash gitignoreSource;
       };
diff --git a/go.mod b/go.mod
index c5466cb..ad95cfa 100644
--- a/go.mod
+++ b/go.mod
@@ -132,6 +132,7 @@ require (
        github.com/vmihailenco/go-tinylfu v0.2.2 // indirect
        github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
        github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
+       gitlab.com/staticnoise/goldmark-callout v0.0.0-20240609120641-6366b799e4ab // indirect
        gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b // indirect
        gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect
        go.opentelemetry.io/auto/sdk v1.1.0 // indirect
diff --git a/go.sum b/go.sum
index 6ecfbfb..a8069e6 100644
--- a/go.sum
+++ b/go.sum
@@ -405,6 +405,8 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
 github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
 github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=
 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
+gitlab.com/staticnoise/goldmark-callout v0.0.0-20240609120641-6366b799e4ab h1:gK9tS6QJw5F0SIhYJnGG2P83kuabOdmWBbSmZhJkz2A=
+gitlab.com/staticnoise/goldmark-callout v0.0.0-20240609120641-6366b799e4ab/go.mod h1:SPu13/NPe1kMrbGoJldQwqtpNhXsmIuHCfm/aaGjU0c=
 gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA=
 gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8=
 gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q=
--
2.49.0

GH went with their own syntax and much of the rest of the markdown ecosystem went a different way. I think it would be wiser not to follow GH.

e.g.

:::note
This is a note
:::

https://github.com/orgs/community/discussions/16925#discussioncomment-2791869

this has been added now with github's style callouts.

sign up or login to add to the discussion
Labels
good-first-issue
area
appview
assignee

None yet.

Participants 3
AT URI
at://did:plc:qxichs7jsycphrsmbujwqbfb/sh.tangled.repo.issue/3ltjxrqjqsl22