diff options
| author | Paul Buetow <paul@buetow.org> | 2025-07-08 23:41:55 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-07-08 23:41:55 +0300 |
| commit | 39f6e8c95b45012a19dbf4da225b4771d70a841d (patch) | |
| tree | 6bba96a19a3edf797a66c9e4d326adff09597514 /internal/showcase | |
| parent | 236792e1f97087df341ba5c3e95ffc244681b482 (diff) | |
fix: remove syntax highlighting labels from code blocks
- Remove language identifiers from code blocks (e.g., ```go becomes ```)
- Remove extractLanguageForHighlighting function as it's no longer needed
- Keep the language info in the description line above the code block
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'internal/showcase')
| -rw-r--r-- | internal/showcase/showcase.go | 60 |
1 files changed, 1 insertions, 59 deletions
diff --git a/internal/showcase/showcase.go b/internal/showcase/showcase.go index 40d5d58..0bce7ee 100644 --- a/internal/showcase/showcase.go +++ b/internal/showcase/showcase.go @@ -493,9 +493,7 @@ func (g *Generator) formatGemtext(summaries []ProjectSummary) string { // Add code snippet at the end for all projects if summary.CodeSnippet != "" { - // Extract the language name for syntax highlighting - languageName := extractLanguageForHighlighting(summary.CodeLanguage) - builder.WriteString(fmt.Sprintf("\n%s:\n\n```%s\n%s\n```\n", summary.CodeLanguage, languageName, summary.CodeSnippet)) + builder.WriteString(fmt.Sprintf("\n%s:\n\n```\n%s\n```\n", summary.CodeLanguage, summary.CodeSnippet)) } } @@ -719,59 +717,3 @@ func detectAIUsage(repoPath string) bool { return false } -// extractLanguageForHighlighting extracts the language name from the CodeLanguage string -// for syntax highlighting in code blocks -func extractLanguageForHighlighting(codeLanguage string) string { - // codeLanguage format: "Language from `path/to/file`" - // Extract just the language name - parts := strings.Split(codeLanguage, " ") - if len(parts) > 0 { - lang := strings.ToLower(parts[0]) - - // Map language names to syntax highlighting identifiers - // Based on source-highlight --lang-list output - languageMap := map[string]string{ - "go": "go", - "python": "python", - "javascript": "javascript", - "typescript": "javascript", // Use javascript for TypeScript - "java": "java", - "c": "c", - "c++": "cpp", - "c/c++": "cpp", - "c#": "csharp", - "ruby": "ruby", - "rust": "rust", - "shell": "sh", // source-highlight uses sh.lang - "bash": "bash", - "perl": "perl", - "raku": "perl", // Use perl highlighting for Raku - "php": "php", - "swift": "swift", - "kotlin": "java", // Use java highlighting for Kotlin - "haskell": "haskell", - "lua": "lua", - "html": "html", - "css": "css", - "sql": "sql", - "make": "makefile", - "docker": "dockerfile", - "yaml": "yaml", - "json": "json", - "xml": "xml", - "toml": "toml", - "hcl": "hcl", - "vim": "vim", - "awk": "awk", - } - - if mapped, ok := languageMap[lang]; ok { - return mapped - } - - // Return the original language name if no mapping exists - return lang - } - - return "" -}
\ No newline at end of file |
