GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - rieg-ec/md_to_notion: Convert markdown to Notion blocks with pure Ruby 💫

BranchesTags
Open more actions menu

Latest commit

 

History

14 Commits
14 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
bin
bin
 
 
lib
lib
 
 
sig
sig
 
 
spec
spec
 
 
.eslintrc.json
.eslintrc.json
 
 
.gitignore
.gitignore
 
 
.rspec
.rspec
 
 
.rubocop.yml
.rubocop.yml
 
 
.ruby-version
.ruby-version
 
 
Gemfile
Gemfile
 
 
Gemfile.lock
Gemfile.lock
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 
Rakefile
Rakefile
 
 
md_to_notion.gemspec
md_to_notion.gemspec
 
 

Repository files navigation

MdToNotion: Markdown to Notion

Dependency-free gem to convert markdown and GitHub flavoured Markdown to Notion API blocks and richtext.

NOTE: this is a work in progress. It works for simple markdown, but has not been tested with all markdown syntax.

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add md_to_notion

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install md_to_notion

Usage

MdToNotion::Parser.markdown_to_notion_blocks(
  "# heading 1"
)
result
{
    "type": "heading_1",
    "heading_1": {
      "rich_text": [
        {
          "type": "text",
          "text": {
            "content": "heading 1",
            "link": null
          },
          "annotations": {
            "bold": false,
            "italic": false,
            "strikethrough": false,
            "underline": false,
            "code": false
          },
          "href": null
        }
      ]
    }
  }

MdToNotion::Parser.markdown_to_notion_blocks(
  "> quote with *italic"
)
result
{
  "type": "quote",
  "quote": {
    "rich_text": [
      {
        "type": "text",
        "text": {
          "content": "quote with ",
          "link": null
        },
        "annotations": {
          "bold": false,
          "italic": false,
          "strikethrough": false,
          "underline": false,
          "code": false
        },
        "href": null
      },
      {
        "type": "text",
        "text": {
          "content": "italic",
          "link": null
        },
        "annotations": {
          "bold": false,
          "italic": true,
          "strikethrough": false,
          "underline": false,
          "code": false
        },
        "href": null
      }
    ]
  }
}

MdToNotion::Parser.markdown_to_notion_blocks <<~CODE
``ruby
puts 'it works with code blocks too!'
``
CODE
result
{
  "type": "code",
  "code": {
    "rich_text": [
      {
        "type": "text",
        "text": {
          "content": "puts 'it works with code blocks too!'",
          "content": null
        },
        "annotations": {
          "bold": false,
          "italic": false,
          "strikethrough": false,
          "underline": false,
          "code": false
        },
        "href": null
      }
    ],
    "language": "ruby"
  }
}

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/rieg-ec/md_to_notion.

License

The gem is available as open source under the terms of the MIT License.

About

Convert markdown to Notion blocks with pure Ruby 💫

Resources

Readme
MIT license
Activity

Stars

10 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.