84 lines
1.6 KiB
Markdown
84 lines
1.6 KiB
Markdown
|
# json2md - JSON to Markdown Converter
|
||
|
|
||
|
A Go module for converting academic paper review data from JSON to formatted Markdown reports.
|
||
|
|
||
|
## Features
|
||
|
- CLI interface for easy conversion
|
||
|
- Reusable library package
|
||
|
- Supports accepted/rejected paper categorization
|
||
|
- Preserves abstract formatting
|
||
|
- Generates arXiv links automatically
|
||
|
|
||
|
## Installation
|
||
|
```bash
|
||
|
git clone https://github.com/yourusername/json2md.git
|
||
|
cd json2md
|
||
|
go build
|
||
|
```
|
||
|
|
||
|
## Command Line Usage
|
||
|
```bash
|
||
|
./json2md --input papers.json --output results.md
|
||
|
|
||
|
# Or directly via Go:
|
||
|
go run main.go --input ../papers.json --output ../results.md
|
||
|
```
|
||
|
|
||
|
## Library Usage
|
||
|
```go
|
||
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"json2md/lib"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
// Process JSON file
|
||
|
data, err := lib.ProcessJSONFile("input.json")
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
|
||
|
// Generate Markdown
|
||
|
if err := lib.GenerateMarkdown(data, "output.md"); err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
|
||
|
fmt.Println("Conversion successful!")
|
||
|
}
|
||
|
```
|
||
|
|
||
|
## Input JSON Format
|
||
|
Expected structure:
|
||
|
```json
|
||
|
{
|
||
|
"accepted": [
|
||
|
{
|
||
|
"paper": {
|
||
|
"title": "Paper Title",
|
||
|
"arxiv_id": "1234.56789",
|
||
|
"abstract": "Paper abstract..."
|
||
|
},
|
||
|
"explanation": "Acceptance reason"
|
||
|
}
|
||
|
],
|
||
|
"rejected": [
|
||
|
{
|
||
|
"paper": { /* same structure */ },
|
||
|
"explanation": "Rejection reason"
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
```
|
||
|
|
||
|
## Project Structure
|
||
|
```
|
||
|
json2md/
|
||
|
├── lib/ # Core conversion library
|
||
|
│ └── lib.go
|
||
|
├── main.go # CLI interface
|
||
|
├── go.mod # Module configuration
|
||
|
└── README.md # This file
|
||
|
```
|