notionx

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

README

notionx

A simple utility to convert markdown files to Notion Blocks.

Example

package main

import (
	"encoding/json"
	"fmt"

	"github.com/tenz-io/gokit/notionx"
)

func main() {
	md := "# hello **notionx**"
	blocks, err := notionx.MarkdownToNotionBlocks(md)
	if err != nil {
		fmt.Printf("MarkdownToNotionBlocks() error = %v", err)
		return
	}
	j, err := json.Marshal(blocks)
	if err != nil {
		fmt.Printf("json.Marshal() error = %v", err)
		return
	}
	fmt.Printf("blocks: %s", j)
}

Explanation:

  • The above code will convert the markdown string # hello **notionx** to Notion Blocks.
  • The output will be a JSON string representing the Notion Blocks.
  • The JSON string can be used to create a Notion page using the Notion API.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarkdownToNotionBlocks

func MarkdownToNotionBlocks(markdown string) ([]notionapi.Block, error)

MarkdownToNotionBlocks converts a Markdown string to a slice of Notion blocks.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL