0.0
The project is in a healthy, maintained state
Parses text and generates Bluesky rich text facets
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

~> 2.12.2
 Project Readme

Bsky Parser

Gem that will parse text content and generate Bluesky rich text facets.

Facets supported:

  • Mentions aka @handles
  • Hashtags
  • URLs as well as markdown-style links

Installation

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

$ bundle add bsky-parser
$ bundle install

Usage

The gem provides a simple interface to parse text content:

content = "Check out this blog post [My Blog](https://example.com) and follow @handle.bsky.social! #ruby"
parsed_content, facets = BskyParser.parse(content)

# Example usage:
# request_body = {
#   repo: user_did,
#   collection: "app.bsky.feed.post",
#   record: {
#     text: parsed_content,
#     facets: facets,
#     createdAt: current_time,
#     "$type": "app.bsky.feed.post"
#   }
# }

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test 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. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

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