Skip to content

Commit

Permalink
chore: add new md file to be tested, fix style issues on code
Browse files Browse the repository at this point in the history
  • Loading branch information
ycd committed May 8, 2021
1 parent a11d452 commit ea8d420
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 1 addition & 3 deletions pkg/toc/toc.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func (t *toc) logic() {
os.Exit(1)
}
color.Green("✔ Table of contents generated successfully")

}

func (t *toc) String() (s string) {
Expand Down Expand Up @@ -151,7 +150,7 @@ func (t *toc) add(content string) {

func (t *toc) readFile() ([]byte, error) {
if _, err := os.Stat(t.Options.Path); os.IsNotExist(err) {
return nil, fmt.Errorf(fmt.Sprintf("path '%s' doesn't exists", t.Options.Path))
return nil, fmt.Errorf("path '%s' doesn't exists", t.Options.Path)
}

file, err := ioutil.ReadFile(t.Options.Path)
Expand Down Expand Up @@ -211,7 +210,6 @@ func (t *toc) reformatMarkdown(markdown string) (string, error) {
}

func (t *toc) writeToFile(markdown string) error {

markdown, err := t.reformatMarkdown(markdown)
if err != nil {
return err
Expand Down
11 changes: 11 additions & 0 deletions test-markdowns/test2-md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Header 1

<!-- toc -->

## Header 2.1

## Header 2.2

### Header 2.2.3.1

### Header 2.2.3.2

0 comments on commit ea8d420

Please sign in to comment.