Skip to content
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

Update forked module name, paths, and docs to be imported; support for applying multiple options in a TermRendererOption #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Glamour
# Why is this forked?

This is hard forked from github.com/charmbracelet/glamour to allow the `gh` maintainers to enhance the use of `glamour` in `gh`, while providing the flexibility for us to share modifications and extensions. It is not intended to be a long-term maintained fork and you should not rely on it.

Once we determine how to address concerns for the project, we will decide what to do next based on how our needs align with the preferences of the maintainers of charmbracelet/glamour.

## Original README with minor tweaks to indicate upstream/fork relationship

<p>
<img src="https://github.com/user-attachments/assets/23aabf2a-8bd8-4e7b-bb50-993bce32541d" width="300" alt="Glamour Title Treatment"><br>
Expand Down
2 changes: 1 addition & 1 deletion examples/artichokes/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"log"
"os"

"github.com/charmbracelet/glamour"
"github.com/cli/glamour"
"github.com/muesli/termenv"
)

Expand Down
2 changes: 1 addition & 1 deletion examples/custom_renderer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"

"github.com/charmbracelet/glamour"
"github.com/cli/glamour"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/helloworld/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"

"github.com/charmbracelet/glamour"
"github.com/cli/glamour"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/stdin-stdout-custom-styles/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"io"
"os"

"github.com/charmbracelet/glamour"
"github.com/cli/glamour"
)

const defaultWidth = 80
Expand Down
2 changes: 1 addition & 1 deletion examples/stdin-stdout/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"io"
"os"

"github.com/charmbracelet/glamour"
"github.com/cli/glamour"
)

const defaultWidth = 80
Expand Down
16 changes: 14 additions & 2 deletions glamour.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"github.com/yuin/goldmark/util"
"golang.org/x/term"

"github.com/charmbracelet/glamour/ansi"
styles "github.com/charmbracelet/glamour/styles"
"github.com/cli/glamour/ansi"
styles "github.com/cli/glamour/styles"
)

const (
Expand Down Expand Up @@ -215,6 +215,18 @@ func WithChromaFormatter(formatter string) TermRendererOption {
}
}

// WithOptions sets multiple TermRenderer options within a single TermRendererOption.
func WithOptions(options ...TermRendererOption) TermRendererOption {
return func(tr *TermRenderer) error {
for _, o := range options {
if err := o(tr); err != nil {
return err
}
}
return nil
}
}

func (tr *TermRenderer) Read(b []byte) (int, error) {
return tr.renderBuf.Read(b)
}
Expand Down
2 changes: 1 addition & 1 deletion glamour_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"strings"
"testing"

styles "github.com/charmbracelet/glamour/styles"
"github.com/charmbracelet/x/exp/golden"
styles "github.com/cli/glamour/styles"
)

const markdown = "testdata/readme.markdown.in"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/charmbracelet/glamour
module github.com/cli/glamour

go 1.21

Expand Down
4 changes: 2 additions & 2 deletions internal/generate-style-json/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"os"
"path/filepath"

"github.com/charmbracelet/glamour/ansi"
styles "github.com/charmbracelet/glamour/styles"
"github.com/cli/glamour/ansi"
styles "github.com/cli/glamour/styles"
)

func writeStyleJSON(filename string, styleConfig *ansi.StyleConfig) error {
Expand Down
2 changes: 1 addition & 1 deletion styles/dracula.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package styles

import "github.com/charmbracelet/glamour/ansi"
import "github.com/cli/glamour/ansi"

// DraculaStyleConfig is the dracula style.
var DraculaStyleConfig = ansi.StyleConfig{
Expand Down
2 changes: 1 addition & 1 deletion styles/styles.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package styles
//go:generate go run ../internal/generate-style-json

import (
"github.com/charmbracelet/glamour/ansi"
"github.com/cli/glamour/ansi"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion styles/tokyo-night.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package styles

import "github.com/charmbracelet/glamour/ansi"
import "github.com/cli/glamour/ansi"

// TokyoNightStyle is the tokyo night style.
var TokyoNightStyleConfig = ansi.StyleConfig{
Expand Down