Code Blocks For Websites

An Opensource solution to show Code on website in better way

GITHUB HOW TO USE

HOW TO USE IT

You can use it in two ways see them below

• Use below style and script tag in your html and enjoy it

<link href="https://codewithalvin.github.io/code_tag_for_websites/src/style.css" rel="stylesheet" > <script src="https://codewithalvin.github.io/code_tag_for_websites/src/script.js"></script>

OR

• Copy and use the source code from Github The file You are looking for are in src directory

Look at at example below

Writting this 👇

CodeExample

Gives that 👇 Note if you are using html inside <code> then do consider encoding the html first

import requests #for web fetching from bs4 import BeautifulSoup #for parsing class Scrape: def __init__(self,url): self.url=url def fetch(self,url): headers={"User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"} page=requests.get(url,headers=headers).content soup = BeautifulSoup(page, 'html.parser') return soup.prettify() def get_by_name(self,name): pass def get_by_username(self,username): url=self.url+username return self.fetch(url)

EDIT THEME

Overwrite the class .dark_nav .dark_code .light_nav .light_code

Note that .dark_code and .dark_nav work together and .light_nav and .light_code together.