Skip to content

Commit

Permalink
Support for numbered lists (functions, viewpoints) in Markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
k1LoW committed Jun 14, 2023
1 parent edcd4ba commit c6d33b2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 8 additions & 0 deletions output/md/md.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,10 @@ func (m *Md) makeSchemaTemplateData(s *schema.Schema) map[string]interface{} {
functionData = append(functionData, data)
}

if number {
functionData = m.addNumberToTable(functionData)
}

// Viewpoints
viewpointData := [][]string{}
viewpointHeader := []string{
Expand All @@ -503,6 +507,10 @@ func (m *Md) makeSchemaTemplateData(s *schema.Schema) map[string]interface{} {
viewpointData = append(viewpointData, data)
}

if number {
viewpointData = m.addNumberToTable(viewpointData)
}

if adjust {
return map[string]interface{}{
"Schema": s,
Expand Down
12 changes: 6 additions & 6 deletions testdata/md_test_README.md.number.golden
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

## Viewpoints

| Name | Description |
| ---- | ----------- |
| [table a b](viewpoint-0.md) | select table a and b |
| [label blue](viewpoint-1.md) | select label blue |
| [label green](viewpoint-2.md) | select label green |
| [table a label red](viewpoint-3.md) | select table a and label red<br><br>- table a<br>- label red |
| # | Name | Description |
| - | ---- | ----------- |
| 1 | [table a b](viewpoint-0.md) | select table a and b |
| 2 | [label blue](viewpoint-1.md) | select label blue |
| 3 | [label green](viewpoint-2.md) | select label green |
| 4 | [table a label red](viewpoint-3.md) | select table a and label red<br><br>- table a<br>- label red |

## Tables

Expand Down

0 comments on commit c6d33b2

Please # to comment.