Skip to content

Commit

Permalink
chore: fix string renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyjoygh committed Jun 30, 2024
1 parent e3c6ebe commit 321667d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
6 changes: 3 additions & 3 deletions renderer/html/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import (
"github.com/usememos/gomark/ast"
)

type RendererContext struct {
}

// HTMLRenderer is a simple renderer that converts AST to HTML.
type HTMLRenderer struct {
output *bytes.Buffer
context *RendererContext
}

type RendererContext struct {
}

// NewHTMLRenderer creates a new HTMLRender.
func NewHTMLRenderer() *HTMLRenderer {
return &HTMLRenderer{
Expand Down
19 changes: 3 additions & 16 deletions renderer/string/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import (
"github.com/usememos/gomark/ast"
)

type RendererContext struct {
}

// StringRenderer renders AST to raw string.
type StringRenderer struct {
output *bytes.Buffer
context *RendererContext
}

type RendererContext struct {
}

// NewStringRenderer creates a new StringRender.
func NewStringRenderer() *StringRenderer {
return &StringRenderer{
Expand Down Expand Up @@ -180,11 +180,6 @@ func (r *StringRenderer) renderTable(node *ast.Table) {
}

func (r *StringRenderer) renderEmbeddedContent(node *ast.EmbeddedContent) {

Check warning on line 182 in renderer/string/string.go

View workflow job for this annotation

GitHub Actions / go-static-checks

unused-parameter: parameter 'node' seems to be unused, consider removing or renaming it as _ (revive)
r.output.WriteString(node.ResourceName)
if node.Params != "" {
r.output.WriteString("?")
r.output.WriteString(node.Params)
}
}

func (r *StringRenderer) renderText(node *ast.Text) {
Expand All @@ -204,13 +199,10 @@ func (r *StringRenderer) renderBoldItalic(node *ast.BoldItalic) {
}

func (r *StringRenderer) renderCode(node *ast.Code) {
r.output.WriteString("`")
r.output.WriteString(node.Content)
r.output.WriteString("`")
}

func (r *StringRenderer) renderImage(node *ast.Image) {

Check warning on line 205 in renderer/string/string.go

View workflow job for this annotation

GitHub Actions / go-static-checks

unused-parameter: parameter 'node' seems to be unused, consider removing or renaming it as _ (revive)
r.output.WriteString(node.AltText)
}

func (r *StringRenderer) renderLink(node *ast.Link) {
Expand Down Expand Up @@ -252,11 +244,6 @@ func (r *StringRenderer) renderSuperscript(node *ast.Superscript) {
}

func (r *StringRenderer) renderReferencedContent(node *ast.ReferencedContent) {

Check warning on line 246 in renderer/string/string.go

View workflow job for this annotation

GitHub Actions / go-static-checks

unused-parameter: parameter 'node' seems to be unused, consider removing or renaming it as _ (revive)
r.output.WriteString(node.ResourceName)
if node.Params != "" {
r.output.WriteString("?")
r.output.WriteString(node.Params)
}
}

func (r *StringRenderer) renderSpoiler(node *ast.Spoiler) {
Expand Down

0 comments on commit 321667d

Please sign in to comment.