Coder Social home page Coder Social logo

oh-see-gists's Introduction

Oh See Gists

Current Release Build Status Badge Coverage Status Maintainability Score Downloads MIT License

Use GitHub Gists to embed your code snippets on your site. Example: https://ohseemedia.com/posts/hooks-can-only-be-called-inside-the-body-of-a-function-component-reactjs-error/

Installation

Install the add-on:

composer require ohseesoftware/oh-see-gists

Publish the add-on's assets:

php artisan vendor:publish --tag=oh-see-gists

This will publish:

  • a config file for the GitHub API
  • views in the resources/views directory
  • fieldsets in the resources/fieldsets directory

Usage

Add your GitHub token to your .env file

You'll need to create a new personal access token. You can do so here: https://github.com/settings/tokens/new.

The token only needs the gist scope.

Add the token as OH_SEE_GISTS_GITHUB_TOKEN in your .env file.

Add the fieldset to your blueprint(s)

The fieldset that will be published is named gist_block. You will need to update your blueprints to reference the fieldset wherever you want it to be used. As an example in bard:

type: bard
sets:
  gist_content:
    display: Gist
    fields:
      - import: gist_block

Naming

There are two very important naming conventions you have to follow:

  • The gist_content name for the fieldset is very important. The add-on references this key so you cannot change it.
  • Your bard block has to be named content for the add-on to save to your GitHub Gists. Otherwise, you will be just creating code blocks on your Statamic site.

Use the partial in your templates

The add-on publishes a partial for you to use in your templates to render the Gists. You can use it like so:

{{ bard_content }}
    {{ if type == "gist_content" }}
        {{ partial src="partials/gist_content" }}
    {{ /if }}
{{ /bard_content }}

oh-see-gists's People

Contributors

christopherdosin avatar dependabot-preview[bot] avatar dependabot[bot] avatar duncanmcclean avatar owenconti avatar tjefford avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

oh-see-gists's Issues

Supporting guzzle 7?

Hey there, Thank you for making this package available to the community. I am trying to install it to my Statamic site and it looks like getting a conflict because somehow my site is requiring guzzle 7. Not sure where the requirement is coming from, including my composer.json below. Getting the always fun Your requirements could not be resolved to an installable set of packages. issue. Would we be able to update this package to allow for guzzle 7? Getting this error with Statamic 3.0.43.

composer.json:

{
    "name": "statamic/starter-kit-cool-writings",
    "description": "Statamic",
    "keywords": ["statamic", "cms", "starter", "flat file", "laravel"],
    "type": "project",
    "require": {
        "php": "^7.1.3",
        "fideloper/proxy": "^4.0",
        "laravel/framework": "^6.2",
        "laravel/tinker": "^1.0",
        "spatie/laravel-sitemap": "5.4.0",
        "statamic/cms": "3.0.43",
        "statamic/ssg": "^0.2.0"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.1",
        "facade/ignition": "^1.3",
        "filp/whoops": "^2.0",
        "nunomaduro/collision": "^3.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "phpunit/phpunit": "^7.5"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi",
            "@php artisan statamic:install --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate"
        ]
    }
}

Install issue:

$ composer require ohseesoftware/oh-see-gists
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2 is now available and you should upgrade. See https://getcomposer.org/2
Using version ^2.1 for ohseesoftware/oh-see-gists
./composer.json has been updated
Loading composer repositories with package information
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2 is now available and you should upgrade. See https://getcomposer.org/2
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for ohseesoftware/oh-see-gists ^2.1 -> satisfiable by ohseesoftware/oh-see-gists[v2.1.0].
    - Conclusion: remove guzzlehttp/guzzle 7.2.0
    - Conclusion: don't install guzzlehttp/guzzle 7.2.0
    - ohseesoftware/oh-see-gists v2.1.0 requires php-http/guzzle6-adapter ^2.0 -> satisfiable by php-http/guzzle6-adapter[2.x-dev, v2.0.0, v2.0.1].
    - php-http/guzzle6-adapter 2.x-dev requires guzzlehttp/guzzle ^6.0 -> satisfiable by guzzlehttp/guzzle[6.0.0, 6.0.1, 6.0.2, 6.1.0, 6.1.1, 6.2.0, 6.2.1, 6.2.2, 6.2.3, 6.3.0, 6.3.1, 6.3.2, 6.3.3, 6.4.0, 6.4.1, 6.5.0, 6.5.1, 6.5.2, 6.5.3,
   ...
    - Can only install one of: guzzlehttp/guzzle[6.3.0, 7.2.0].

Update oh-see-gists for Statamic 4

Hello! Statamic4 is out now and during the upgrade process I noticed the plugin is locked to ^3.2. I have created a PR to address this by bumping the dependency to ^4.0. #7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.