Skip to content

Instantly share code, notes, and snippets.

@rahulbanerjee26
Created September 25, 2022 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahulbanerjee26/675a40e657f98a75b09418b8c06bc201 to your computer and use it in GitHub Desktop.
Save rahulbanerjee26/675a40e657f98a75b09418b8c06bc201 to your computer and use it in GitHub Desktop.
import os
from dotenv import load_dotenv
load_dotenv()
GITHUB_TOKEN = os.environ.get('GITHUB_TOKEN')
domain = ""
title = ""
post_wp = True
post_medium = True
post_devto = True
post_hashnode = True
with open("index.md", "r") as f:
post_content_md = f.read()
snippets = getCodeSnippetsFromMarkdown(post_content_md)
gistURLs = createGists(
GITHUB_TOKEN,
snippets,
public=True
)
new_content = replaceCodeSnippetsWithGists(
post_content_md,
gistURLs,
title,
hashnode=post_hashnode,
devto=post_devto,
medium=post_medium,
wp=post_wp
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment