New Gem - Insert github repo code into Github Pages
- Lingua principale
- Ruby
- Stelle
- 1.9k
- Fork
- 360
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
# New Gem Feature Request
I know Gem plug-ins are somewhat frowned upon for security and stability reasons. However, I hope this request will be met with broad acceptance.
I recently stumbled across a [gem](https://blog.bryanroessler.com/2020-03-18-insert-code-blocks-from-repository/) that will include your repo source code into your Github Pages Jekyll blog post. The advantage of this gem is:
- You no longer have to copy your source code from your repo/file to your blog post.
- You can update your repo source code without having to worry your blog will be up-to-date when your Github Pages site is rebuilt.
- All too often people update their repo source code and think: *"I'll update the blog later"* but, time passes and they forget to update the blog.
The gem is pretty simple:
``` ruby
# Dynamically insert code block from URL
# From: https://blog.bryanroessler.com/2020-03-18-insert-code-blocks-from-repository/
require 'open-uri'
module Jekyll
class InsertGitCode < Liquid::Tag
def initialize(tag_name, url, tokens)
super
url = url.strip()
@filename = File.basename(url)
encoded_url = URI.encode(url)
@file = URI.parse(encoded_url).read
end
def render(_context)
@file
end
end
end
Liquid::Template.register_tag('insert_git_code', Jekyll::InsertGitCode)
```
Calling the gem is by a simple liquid tag:
``` liquid
{% highlight ruby %}
{% insert_git_code https://git... %}
{% endhighlight %}
```
### Thank you for considering this request!
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
La richiesta non nomina file del repository, test o punti di ingresso. Inizia esaminando l’integrazione esistente di Jekyll e Liquid e le implicazioni di sicurezza del caricamento remoto del codice del repository; l’issue non definisce né un’implementazione concordata né criteri di completamento.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- ruby
- Ambito
- web-dev
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100