-
Notifications
You must be signed in to change notification settings - Fork 404
feat(gnoweb): readme markdown viewer for p/ & r/ #4101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
alexiscolin
wants to merge
20
commits into
gnolang:master
Choose a base branch
from
alexiscolin:feat/gnoweb-source-readme-viewer
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,352
−423
Draft
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b696faa
feat: readme viewer
alexiscolin 80117b0
feat: read markdown from directory
alexiscolin 367e703
refactor: remove readme sorting
alexiscolin 0ff7d79
Merge branch 'master' into feat/gnoweb-source-readme-viewer
alexiscolin 2394941
fix: comments
alexiscolin a4e4d05
feat: add md style and fix ext_links
alexiscolin 8fc2ffe
fix: add renderMd in mock
alexiscolin e27525b
feat: render markdown in source page
alexiscolin 2e068b1
fix: tests
alexiscolin 771a9d3
Merge branch 'master' into feat/gnoweb-source-readme-viewer
alexiscolin 908b077
feat: webclient_html tests
alexiscolin 63ab36f
fix: lint
alexiscolin 73caa21
fix: tests
alexiscolin 3e5d976
Merge branch 'master' into feat/gnoweb-source-readme-viewer
alexiscolin 05a698c
fix: tests
alexiscolin 6e860be
chore: lint
alexiscolin 53ea20f
chore: add tests
alexiscolin 347a21a
Merge branch 'gnolang:master' into feat/gnoweb-source-readme-viewer
alexiscolin fc637bf
fix: tests
14b7930
fix: linter
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{{ define "layout/article" }} | ||
<md-renderer class="{{ if .Classes }}{{ .Classes }}{{ end }} mt-4 lg:mt-0 lg:col-span-7 pb-24">{{ render .ComponentContent }}</md-renderer> | ||
<md-renderer class="{{ if .Classes }}{{ .Classes }}{{ end }} mt-4 lg:mt-0 lg:col-span-7 pb-14 mb-14">{{ render .ComponentContent }}</md-renderer> | ||
{{ end }} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,40 @@ | ||
{{ define "renderDir" }} | ||
{{ $pkgpath := .PkgPath }} | ||
<article class="code-content mt-10 lg:col-span-7 pb-24 text-gray-900"> | ||
<div class="flex flex-col md:flex-row justify-between mb-4 md:items-center"> | ||
<div class="flex items-center gap-8"> | ||
<h1 class="text-600 font-bold">{{ $pkgpath }}</h1> | ||
</div> | ||
<div class="flex gap-4 text-gray-300 pt-0.5"> | ||
<span class="text-gray-300">Directory · {{ .FileCounter }} Files</span> | ||
</div> | ||
</div> | ||
|
||
<div class="source-code font-mono mt-6"> | ||
<ul> | ||
{{ range .Files }} | ||
<li class="border-b first:border-t"> | ||
<a class="py-2 flex justify-between items-center px-2 text-gray-600 line-clamp-2 hover:bg-gray-100" href="{{ $pkgpath }}$source&file={{ . }}"> | ||
<span class="flex items-center gap-2"> | ||
<svg class="w-4 h-4 shrink-0"> | ||
<use href="#ico-file"></use> | ||
</svg> | ||
{{ . }} | ||
</span> | ||
<span class="text-gray-300">Open</span> | ||
</a> | ||
</li> | ||
{{ end }} | ||
</ul> | ||
</div> | ||
</article> | ||
{{ end }} | ||
{{ define "renderDir" }} {{ $pkgpath := .PkgPath }} | ||
<article class="code-content mt-10 lg:col-span-7 mb-20 text-gray-900"> | ||
<div class="flex flex-col md:flex-row justify-between mb-4 md:items-center"> | ||
<div class="flex items-center gap-8"> | ||
<h1 class="text-600 font-bold">{{ $pkgpath }}</h1> | ||
</div> | ||
<div class="flex gap-4 text-gray-300 pt-0.5"> | ||
<span class="text-gray-300">Directory · {{ .FileCounter }} Files</span> | ||
</div> | ||
</div> | ||
|
||
<div class="source-code font-mono mt-6"> | ||
<ul> | ||
{{ range .Files }} | ||
<li class="border-b first:border-t"> | ||
<a class="group py-2 flex justify-between items-center px-2 text-gray-600 line-clamp-2 hover:bg-gray-100" href="{{ $pkgpath }}$source&file={{ . }}"> | ||
<span class="flex items-center gap-2"> | ||
<svg class="w-4 h-4 shrink-0"> | ||
<use href="#ico-file"></use> | ||
</svg> | ||
{{ . }} | ||
</span> | ||
<span class="text-gray-300 group-hover:text-gray-600 font-interVar">Open</span> | ||
</a> | ||
</li> | ||
{{ end }} | ||
</ul> | ||
</div> | ||
</article> | ||
{{ if .Article.ComponentContent }} | ||
<div class="flex justify-between lg:col-span-7 mb-4 px-2 text-gray-900"> | ||
<span class="flex items-center gap-1 text-gray-600 font-mono"> | ||
<svg class="w-4 h-4 shrink-0"> | ||
<use href="#ico-readme"></use> | ||
</svg> | ||
<span>README.md</span> | ||
</span> | ||
<a href="{{ $pkgpath }}$source&file=README.md" class="text-gray-300 hover:text-gray-600">Open</a> | ||
</div> | ||
{{ template "layout/article" .Article }} {{ end }} {{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,45 @@ | ||
{{ define "renderSource" }} | ||
<!-- Source ToC --> | ||
{{ with render .ComponentTOC }} | ||
{{ template "layout/aside" . }} | ||
{{ end }} | ||
<!-- Source ToC --> | ||
{{ with render .ComponentTOC }} {{ template "layout/aside" . }} {{ end }} | ||
|
||
<!-- Source Info --> | ||
<header class="mt-10 lg:row-start-1 row-span-1 col-span-1 lg:col-span-7 flex flex-col xl:flex-row justify-between mb-4"> | ||
<div class="flex items-center"> | ||
<h1 class="text-600 text-gray-900 font-bold">{{ .FileName }}</h1> | ||
</div> | ||
<div class="flex gap-12 text-gray-300 items-center justify-between text-gray-400"> | ||
<span class="pt-0.5">{{ .FileSize }} · {{ .FileLines }} lines</span> | ||
<div class="flex gap-2 xl:gap-4 items-center"> | ||
{{ if .IsMarkdown }} {{ if eq .Mode 0 }} | ||
<a href="{{ .PkgPath }}$source&file={{ .FileName }}" class="flex items-center gap-0.5 pt-0.5 hover:text-gray-600"> | ||
<svg class="w-5 h-5 xxl:w-4 xxl:h-4 shrink-0 inline-block"> | ||
<use href="#ico-content"></use> | ||
</svg> | ||
<span class="hidden xl:inline">Preview</span> | ||
</a> | ||
{{ else }} | ||
<a href="{{ .PkgPath }}$source&file={{ .FileName }}&plain" class="flex items-center gap-0.5 pt-0.5 hover:text-gray-600"> | ||
<svg class="w-5 h-5 xxl:w-4 xxl:h-4 shrink-0 inline-block"> | ||
<use href="#ico-code"></use> | ||
</svg> | ||
<span class="hidden xl:inline">Code</span> | ||
</a> | ||
{{ end }} {{ end }} {{ if not .IsMarkdown }} | ||
<button class="js-copy-btn group flex items-center gap-0.5 pt-0.5 hover:text-gray-600" data-copy-btn="source-code"> | ||
{{ template "ui/copy" }} | ||
<span class="hidden xl:inline">Copy</span> | ||
</button> | ||
{{ end }} | ||
|
||
<!-- Source Info --> | ||
<header | ||
class="mt-10 lg:row-start-1 row-span-1 col-span-1 lg:col-span-7 flex flex-col xl:flex-row justify-between mb-4" | ||
> | ||
<div class="flex items-center"> | ||
<h1 class="text-600 text-gray-900 font-bold">{{ .FileName }}</h1> | ||
<a href="{{ .FileDownload }}" class="flex items-center gap-0.5 pt-0.5 hover:text-gray-600" download="{{ .FileName }}"> | ||
<svg class="w-5 h-5 xxl:w-4 xxl:h-4 shrink-0 inline-block"> | ||
<use href="#ico-ddl"></use> | ||
</svg> | ||
<span class="hidden xl:inline">Download</span> | ||
</a> | ||
</div> | ||
<div | ||
class="flex gap-12 text-gray-300 items-center justify-between text-gray-400" | ||
> | ||
<span class="pt-0.5">{{ .FileSize }} · {{ .FileLines }} lines</span> | ||
<div class="flex gap-2 xl:gap-3 items-center"> | ||
<button | ||
class="js-copy-btn group flex items-center gap-0.5 pt-0.5 hover:text-gray-600" | ||
data-copy-btn="source-code" | ||
> | ||
{{ template "ui/copy" }} | ||
<span class="hidden xl:inline">Copy</span> | ||
</button> | ||
<a | ||
href="{{ .FileDownload }}" | ||
class="flex items-center gap-0.5 pt-0.5 hover:text-gray-600" | ||
download="{{ .FileName }}" | ||
> | ||
<svg class="w-5 h-5 xxl:w-4 xxl:h-4 shrink-0 inline-block"> | ||
<use href="#ico-ddl"></use> | ||
</svg> | ||
<span class="hidden xl:inline">Download</span> | ||
</a> | ||
</div> | ||
</div> | ||
</header> | ||
</div> | ||
</header> | ||
|
||
<!-- Source Content --> | ||
{{ template "layout/article" .Article }} | ||
{{ end }} | ||
<!-- Source Content --> | ||
{{ template "layout/article" .Article }} {{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, if you are using this within the template, it makes no sense to use int here. Just change this to string, or find a way to expose this as const within the template. But if it's not something simple, simply use string.