From 78aace8b67518c1a863892092d78803637a3ab1e Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Wed, 27 Mar 2024 20:35:41 -0600 Subject: temp local markdown lib --- generate_me.py | 10 +- markdown3.py | 3852 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ poetry.lock | 19 +- pyproject.toml | 1 + 4 files changed, 3876 insertions(+), 6 deletions(-) create mode 100644 markdown3.py diff --git a/generate_me.py b/generate_me.py index fa39bf9..736cece 100644 --- a/generate_me.py +++ b/generate_me.py @@ -1,4 +1,4 @@ -from markdown2 import Markdown +from markdown3 import Markdown import os from jinja2 import Environment, FileSystemLoader from distutils.dir_util import copy_tree @@ -7,6 +7,8 @@ import email.utils from helper_libs.image_utils import ImageText from PIL import Image +import re + templates = Environment(loader=FileSystemLoader("templates")) src_folder = "Content" out_folder = "docs" @@ -28,9 +30,13 @@ md = Markdown( "task_list", "tables", "target-blank-links", + "header-ids", + "latex", ] ) +# h1 tag regex ignoring any attributes +h1_tag = re.compile(r"]*>(.*?)") def render_markdown_post( html, metadata=None, template="post.html", posts=[], title=None @@ -83,7 +89,7 @@ for x in os.walk(src_folder): fpath = os.path.join(x[0], y) with open(fpath) as f: _html = md.convert(f.read()) - _post_title = _html[4 : _html.find("")] + _post_title = re.search(h1_tag, _html).group(1) _post = _html.metadata _post["title"] = _post_title _post["link"] = fpath.replace(src_folder, "").replace( diff --git a/markdown3.py b/markdown3.py new file mode 100644 index 0000000..599a25f --- /dev/null +++ b/markdown3.py @@ -0,0 +1,3852 @@ +#!/usr/bin/env python +# Copyright (c) 2012 Trent Mick. +# Copyright (c) 2007-2008 ActiveState Corp. +# License: MIT (http://www.opensource.org/licenses/mit-license.php) + +r"""A fast and complete Python implementation of Markdown. + +[from http://daringfireball.net/projects/markdown/] +> Markdown is a text-to-HTML filter; it translates an easy-to-read / +> easy-to-write structured text format into HTML. Markdown's text +> format is most similar to that of plain text email, and supports +> features such as headers, *emphasis*, code blocks, blockquotes, and +> links. +> +> Markdown's syntax is designed not as a generic markup language, but +> specifically to serve as a front-end to (X)HTML. You can use span-level +> HTML tags anywhere in a Markdown document, and you can use block level +> HTML tags (like
and as well). + +Module usage: + + >>> import markdown2 + >>> markdown2.markdown("*boo!*") # or use `html = markdown_path(PATH)` + u'

boo!

\n' + + >>> markdowner = Markdown() + >>> markdowner.convert("*boo!*") + u'

boo!

\n' + >>> markdowner.convert("**boom!**") + u'

boom!

\n' + +This implementation of Markdown implements the full "core" syntax plus a +number of extras (e.g., code syntax coloring, footnotes) as described on +. +""" + +cmdln_desc = """A fast and complete Python implementation of Markdown, a +text-to-HTML conversion tool for web writers. + +Supported extra syntax options (see -x|--extras option below and +see for details): + +* admonitions: Enable parsing of RST admonitions. +* breaks: Control where hard breaks are inserted in the markdown. + Options include: + - on_newline: Replace single new line characters with
when True + - on_backslash: Replace backslashes at the end of a line with
+* break-on-newline: Alias for the on_newline option in the breaks extra. +* code-friendly: Disable _ and __ for em and strong. +* cuddled-lists: Allow lists to be cuddled to the preceding paragraph. +* fenced-code-blocks: Allows a code block to not have to be indented + by fencing it with '```' on a line before and after. Based on + with support for + syntax highlighting. +* footnotes: Support footnotes as in use on daringfireball.net and + implemented in other Markdown processors (tho not in Markdown.pl v1.0.1). +* header-ids: Adds "id" attributes to headers. The id value is a slug of + the header text. +* highlightjs-lang: Allows specifying the language which used for syntax + highlighting when using fenced-code-blocks and highlightjs. +* html-classes: Takes a dict mapping html tag names (lowercase) to a + string to use for a "class" tag attribute. Currently only supports "img", + "table", "thead", "pre", "code", "ul" and "ol" tags. Add an issue if you require + this for other tags. +* link-patterns: Auto-link given regex patterns in text (e.g. bug number + references, revision number references). +* markdown-in-html: Allow the use of `markdown="1"` in a block HTML tag to + have markdown processing be done on its contents. Similar to + but with + some limitations. +* metadata: Extract metadata from a leading '---'-fenced block. + See for details. +* middle-word-em: Allows or disallows emphasis syntax in the middle of words, + defaulting to allow. Disabling this means that `this_text_here` will not be + converted to `thistexthere`. +* nofollow: Add `rel="nofollow"` to add `` tags with an href. See + . +* numbering: Support of generic counters. Non standard extension to + allow sequential numbering of figures, tables, equations, exhibits etc. +* pyshell: Treats unindented Python interactive shell sessions as + blocks. +* smarty-pants: Replaces ' and " with curly quotation marks or curly + apostrophes. Replaces --, ---, ..., and . . . with en dashes, em dashes, + and ellipses. +* spoiler: A special kind of blockquote commonly hidden behind a + click on SO. Syntax per . +* strike: text inside of double tilde is ~~strikethrough~~ +* tag-friendly: Requires atx style headers to have a space between the # and + the header text. Useful for applications that require twitter style tags to + pass through the parser. +* tables: Tables using the same format as GFM + and + PHP-Markdown Extra . +* toc: The returned HTML string gets a new "toc_html" attribute which is + a Table of Contents for the document. (experimental) +* use-file-vars: Look for an Emacs-style markdown-extras file variable to turn + on Extras. +* wiki-tables: Google Code Wiki-style tables. See + . +* wavedrom: Support for generating Wavedrom digital timing diagrams +* xml: Passes one-liner processing instructions and namespaced XML tags. +""" + +# Dev Notes: +# - Python's regex syntax doesn't have '\z', so I'm using '\Z'. I'm +# not yet sure if there implications with this. Compare 'pydoc sre' +# and 'perldoc perlre'. + +__version_info__ = (2, 4, 14) +__version__ = '.'.join(map(str, __version_info__)) +__author__ = "Trent Mick" + +import argparse +import codecs +import logging +import re +import sys +from collections import defaultdict, OrderedDict +from abc import ABC, abstractmethod +import functools +from hashlib import sha256 +from random import randint, random +from typing import Dict, List, Optional, Tuple, Union +from enum import IntEnum, auto + +if sys.version_info[1] < 9: + from typing import Iterable +else: + from collections.abc import Iterable + +# ---- globals + +DEBUG = False +log = logging.getLogger("markdown") + +DEFAULT_TAB_WIDTH = 4 + + +SECRET_SALT = bytes(randint(0, 1000000)) +# MD5 function was previously used for this; the "md5" prefix was kept for +# backwards compatibility. +def _hash_text(s): + return 'md5-' + sha256(SECRET_SALT + s.encode("utf-8")).hexdigest()[32:] + +# Table of hash values for escaped characters: +g_escape_table = dict([(ch, _hash_text(ch)) + for ch in '\\`*_{}[]()>#+-.!']) + +# Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin: +# http://bumppo.net/projects/amputator/ +_AMPERSAND_RE = re.compile(r'&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)') + + +# ---- exceptions +class MarkdownError(Exception): + pass + + +# ---- public api + +def markdown_path(path, encoding="utf-8", + html4tags=False, tab_width=DEFAULT_TAB_WIDTH, + safe_mode=None, extras=None, link_patterns=None, + footnote_title=None, footnote_return_symbol=None, + use_file_vars=False): + fp = codecs.open(path, 'r', encoding) + text = fp.read() + fp.close() + return Markdown(html4tags=html4tags, tab_width=tab_width, + safe_mode=safe_mode, extras=extras, + link_patterns=link_patterns, + footnote_title=footnote_title, + footnote_return_symbol=footnote_return_symbol, + use_file_vars=use_file_vars).convert(text) + + +def markdown(text, html4tags=False, tab_width=DEFAULT_TAB_WIDTH, + safe_mode=None, extras=None, link_patterns=None, + footnote_title=None, footnote_return_symbol=None, + use_file_vars=False, cli=False): + return Markdown(html4tags=html4tags, tab_width=tab_width, + safe_mode=safe_mode, extras=extras, + link_patterns=link_patterns, + footnote_title=footnote_title, + footnote_return_symbol=footnote_return_symbol, + use_file_vars=use_file_vars, cli=cli).convert(text) + + +class Stage(IntEnum): + PREPROCESS = auto() + HASH_HTML = auto() + LINK_DEFS = auto() + + BLOCK_GAMUT = auto() + HEADERS = auto() + LISTS = auto() + CODE_BLOCKS = auto() + BLOCK_QUOTES = auto() + PARAGRAPHS = auto() + + SPAN_GAMUT = auto() + CODE_SPANS = auto() + ESCAPE_SPECIAL = auto() + LINKS = auto() # and auto links + ITALIC_AND_BOLD = auto() + + POSTPROCESS = auto() + UNHASH_HTML = auto() + + +def mark_stage(stage: Stage): + ''' + Decorator that handles executing relevant `Extra`s before and after this `Stage` executes. + ''' + def wrapper(func): + @functools.wraps(func) + def inner(md: 'Markdown', text, *args, **kwargs): + md.stage = stage + # set "order" prop so extras can tell if they're being invoked before/after the stage + md.order = stage - 0.5 + + if stage in Extra._exec_order: + for klass in Extra._exec_order[stage][0]: + if klass.name not in md.extra_classes: + continue + extra = md.extra_classes[klass.name] + if extra.test(text): + text = extra.run(text) + + md.order = stage + text = func(md, text, *args, **kwargs) + md.order = stage + 0.5 + + if stage in Extra._exec_order: + for klass in Extra._exec_order[stage][1]: + if klass.name not in md.extra_classes: + continue + extra = md.extra_classes[klass.name] + if extra.test(text): + text = extra.run(text) + + return text + + return inner + + return wrapper + + +class Markdown(object): + # The dict of "extras" to enable in processing -- a mapping of + # extra name to argument for the extra. Most extras do not have an + # argument, in which case the value is None. + # + # This can be set via (a) subclassing and (b) the constructor + # "extras" argument. + extras = None + # dict of `Extra` names and associated class instances, populated during _setup_extras + extra_classes = None + + urls = None + titles = None + html_blocks = None + html_spans = None + html_removed_text = "{(#HTML#)}" # placeholder removed text that does not trigger bold + html_removed_text_compat = "[HTML_REMOVED]" # for compat with markdown.py + + _toc = None + + # Used to track when we're inside an ordered or unordered list + # (see _ProcessListItems() for details): + list_level = 0 + + stage: Stage + '''Current "stage" of markdown conversion taking place''' + order: int + ''' + Same as `Stage` but will be +/- 0.5 of the value of `Stage`. + This allows extras to check if they are running before or after a particular stage + with `if md.order < md.stage`. + ''' + + _ws_only_line_re = re.compile(r"^[ \t]+$", re.M) + + def __init__(self, html4tags=False, tab_width=4, safe_mode=None, + extras=None, link_patterns=None, + footnote_title=None, footnote_return_symbol=None, + use_file_vars=False, cli=False): + if html4tags: + self.empty_element_suffix = ">" + else: + self.empty_element_suffix = " />" + self.tab_width = tab_width + self.tab = tab_width * " " + + # For compatibility with earlier markdown2.py and with + # markdown.py's safe_mode being a boolean, + # safe_mode == True -> "replace" + if safe_mode is True: + self.safe_mode = "replace" + else: + self.safe_mode = safe_mode + + # Massaging and building the "extras" info. + if self.extras is None: + self.extras = {} + elif not isinstance(self.extras, dict): + self.extras = dict([(e, None) for e in self.extras]) + if extras: + if not isinstance(extras, dict): + extras = dict([(e, None) for e in extras]) + self.extras.update(extras) + assert isinstance(self.extras, dict) + + if "toc" in self.extras: + if "header-ids" not in self.extras: + self.extras["header-ids"] = None # "toc" implies "header-ids" + + if self.extras["toc"] is None: + self._toc_depth = 6 + else: + self._toc_depth = self.extras["toc"].get("depth", 6) + + if 'header-ids' in self.extras: + if not isinstance(self.extras['header-ids'], dict): + self.extras['header-ids'] = { + 'mixed': False, + 'prefix': self.extras['header-ids'], + 'reset-count': True + } + + if 'break-on-newline' in self.extras: + self.extras.setdefault('breaks', {}) + self.extras['breaks']['on_newline'] = True + + if 'link-patterns' in self.extras: + # allow link patterns via extras dict without kwarg explicitly set + link_patterns = link_patterns or extras['link-patterns'] + if link_patterns is None: + # if you have specified that the link-patterns extra SHOULD + # be used (via self.extras) but you haven't provided anything + # via the link_patterns argument then an error is raised + raise MarkdownError("If the 'link-patterns' extra is used, an argument for 'link_patterns' is required") + self.extras['link-patterns'] = link_patterns + + self._instance_extras = self.extras.copy() + self.link_patterns = link_patterns + self.footnote_title = footnote_title + self.footnote_return_symbol = footnote_return_symbol + self.use_file_vars = use_file_vars + self._outdent_re = re.compile(r'^(\t|[ ]{1,%d})' % tab_width, re.M) + self.cli = cli + + self._escape_table = g_escape_table.copy() + self._code_table = {} + if "smarty-pants" in self.extras: + self._escape_table['"'] = _hash_text('"') + self._escape_table["'"] = _hash_text("'") + + def reset(self): + self.urls = {} + self.titles = {} + self.html_blocks = {} + self.html_spans = {} + self.list_level = 0 + self.extras = self._instance_extras.copy() + self._setup_extras() + self._toc = None + + def _setup_extras(self): + if "footnotes" in self.extras: + # order of insertion matters for footnotes. Use ordered dict for Python < 3.7 + # https://docs.python.org/3/whatsnew/3.7.html#summary-release-highlights + self.footnotes = OrderedDict() + self.footnote_ids = [] + if "header-ids" in self.extras: + if not hasattr(self, '_count_from_header_id') or self.extras['header-ids'].get('reset-count', False): + self._count_from_header_id = defaultdict(int) + if "metadata" in self.extras: + self.metadata = {} + + self.extra_classes = {} + for name, klass in Extra._registry.items(): + if name not in self.extras: + #print(name, "not in", self.extras) + continue + self.extra_classes[name] = klass(self, (self.extras.get(name, {}))) + + # Per "rel" + # should only be used in tags with an "href" attribute. + + # Opens the linked document in a new window or tab + # should only used in tags with an "href" attribute. + # same with _a_nofollow + _a_nofollow_or_blank_links = re.compile(r""" + <(a) + ( + [^>]* + href= # href is required + ['"]? # HTML5 attribute values do not have to be quoted + [^#'"] # We don't want to match href values that start with # (like footnotes) + ) + """, + re.IGNORECASE | re.VERBOSE + ) + + def convert(self, text): + """Convert the given text.""" + # Main function. The order in which other subs are called here is + # essential. Link and image substitutions need to happen before + # _EscapeSpecialChars(), so that any *'s or _'s in the + # and tags get encoded. + + # Clear the global hashes. If we don't clear these, you get conflicts + # from other articles when generating a page which contains more than + # one article (e.g. an index page that shows the N most recent + # articles): + self.reset() + + if not isinstance(text, str): + # TODO: perhaps shouldn't presume UTF-8 for string input? + text = str(text, 'utf-8') + + if self.use_file_vars: + # Look for emacs-style file variable hints. + text = self._emacs_oneliner_vars_pat.sub(self._emacs_vars_oneliner_sub, text) + emacs_vars = self._get_emacs_vars(text) + if "markdown-extras" in emacs_vars: + splitter = re.compile("[ ,]+") + for e in splitter.split(emacs_vars["markdown-extras"]): + if '=' in e: + ename, earg = e.split('=', 1) + try: + earg = int(earg) + except ValueError: + pass + else: + ename, earg = e, None + self.extras[ename] = earg + + self._setup_extras() + + # Standardize line endings: + text = text.replace("\r\n", "\n") + text = text.replace("\r", "\n") + + # Make sure $text ends with a couple of newlines: + text += "\n\n" + + # Convert all tabs to spaces. + text = self._detab(text) + + # Strip any lines consisting only of spaces and tabs. + # This makes subsequent regexen easier to write, because we can + # match consecutive blank lines with /\n+/ instead of something + # contorted like /[ \t]*\n+/ . + text = self._ws_only_line_re.sub("", text) + + # strip metadata from head and extract + if "metadata" in self.extras: + text = self._extract_metadata(text) + + text = self.preprocess(text) + + if self.safe_mode: + text = self._hash_html_spans(text) + + # Turn block-level HTML blocks into hash entries + text = self._hash_html_blocks(text, raw=True) + + # Strip link definitions, store in hashes. + if "footnotes" in self.extras: + # Must do footnotes first because an unlucky footnote defn + # looks like a link defn: + # [^4]: this "looks like a link defn" + text = self._strip_footnote_definitions(text) + text = self._strip_link_definitions(text) + + text = self._run_block_gamut(text) + + if "footnotes" in self.extras: + text = self._add_footnotes(text) + + text = self.postprocess(text) + + text = self._unescape_special_chars(text) + + if self.safe_mode: + text = self._unhash_html_spans(text) + # return the removed text warning to its markdown.py compatible form + text = text.replace(self.html_removed_text, self.html_removed_text_compat) + + do_target_blank_links = "target-blank-links" in self.extras + do_nofollow_links = "nofollow" in self.extras + + if do_target_blank_links and do_nofollow_links: + text = self._a_nofollow_or_blank_links.sub(r'<\1 rel="nofollow noopener" target="_blank"\2', text) + elif do_target_blank_links: + text = self._a_nofollow_or_blank_links.sub(r'<\1 rel="noopener" target="_blank"\2', text) + elif do_nofollow_links: + text = self._a_nofollow_or_blank_links.sub(r'<\1 rel="nofollow"\2', text) + + if "toc" in self.extras and self._toc: + if self.extras['header-ids'].get('mixed'): + # TOC will only be out of order if mixed headers is enabled + def toc_sort(entry): + '''Sort the TOC by order of appearance in text''' + return re.search( + # header tag, any attrs, the ID, any attrs, the text, close tag + r'^<(h%d).*?id=(["\'])%s\2.*>%s$' % (entry[0], entry[1], re.escape(entry[2])), + text, re.M + ).start() + + self._toc.sort(key=toc_sort) + self._toc_html = calculate_toc_html(self._toc) + + # Prepend toc html to output + if self.cli or (self.extras['toc'] is not None and self.extras['toc'].get('prepend', False)): + text = '{}\n{}'.format(self._toc_html, text) + + text += "\n" + + # Attach attrs to output + rv = UnicodeWithAttrs(text) + + if "toc" in self.extras and self._toc: + rv.toc_html = self._toc_html + + if "metadata" in self.extras: + rv.metadata = self.metadata + return rv + + @mark_stage(Stage.POSTPROCESS) + def postprocess(self, text): + """A hook for subclasses to do some postprocessing of the html, if + desired. This is called before unescaping of special chars and + unhashing of raw HTML spans. + """ + return text + + @mark_stage(Stage.PREPROCESS) + def preprocess(self, text): + """A hook for subclasses to do some preprocessing of the Markdown, if + desired. This is called after basic formatting of the text, but prior + to any extras, safe mode, etc. processing. + """ + return text + + # Is metadata if the content starts with optional '---'-fenced `key: value` + # pairs. E.g. (indented for presentation): + # --- + # foo: bar + # another-var: blah blah + # --- + # # header + # or: + # foo: bar + # another-var: blah blah + # + # # header + _meta_data_pattern = re.compile(r''' + ^{0}( # optional opening fence + (?: + {1}:(?:\n+[ \t]+.*)+ # indented lists + )|(?: + (?:{1}:\s+>(?:\n\s+.*)+?) # multiline long descriptions + (?=\n{1}:\s*.*\n|\s*\Z) # match up until the start of the next key:value definition or the end of the input text + )|(?: + {1}:(?! >).*\n? # simple key:value pair, leading spaces allowed + ) + ){0} # optional closing fence + '''.format(r'(?:---[\ \t]*\n)?', r'[\S \t]*\w[\S \t]*\s*'), re.MULTILINE | re.VERBOSE + ) + + _key_val_list_pat = re.compile( + r"^-(?:[ \t]*([^\n]*)(?:[ \t]*[:-][ \t]*(\S+))?)(?:\n((?:[ \t]+[^\n]+\n?)+))?", + re.MULTILINE, + ) + _key_val_dict_pat = re.compile( + r"^([^:\n]+)[ \t]*:[ \t]*([^\n]*)(?:((?:\n[ \t]+[^\n]+)+))?", re.MULTILINE + ) # grp0: key, grp1: value, grp2: multiline value + _meta_data_fence_pattern = re.compile(r'^---[\ \t]*\n', re.MULTILINE) + _meta_data_newline = re.compile("^\n", re.MULTILINE) + + def _extract_metadata(self, text): + if text.startswith("---"): + fence_splits = re.split(self._meta_data_fence_pattern, text, maxsplit=2) + metadata_content = fence_splits[1] + match = re.findall(self._meta_data_pattern, metadata_content) + if not match: + return text + tail = fence_splits[2] + else: + metadata_split = re.split(self._meta_data_newline, text, maxsplit=1) + metadata_content = metadata_split[0] + match = re.findall(self._meta_data_pattern, metadata_content) + if not match: + return text + tail = metadata_split[1] + + def parse_structured_value(value): + vs = value.lstrip() + vs = value.replace(v[: len(value) - len(vs)], "\n")[1:] + + # List + if vs.startswith("-"): + r = [] + for match in re.findall(self._key_val_list_pat, vs): + if match[0] and not match[1] and not match[2]: + r.append(match[0].strip()) + elif match[0] == ">" and not match[1] and match[2]: + r.append(match[2].strip()) + elif match[0] and match[1]: + r.append({match[0].strip(): match[1].strip()}) + elif not match[0] and not match[1] and match[2]: + r.append(parse_structured_value(match[2])) + else: + # Broken case + pass + + return r + + # Dict + else: + return { + match[0].strip(): ( + match[1].strip() + if match[1] + else parse_structured_value(match[2]) + ) + for match in re.findall(self._key_val_dict_pat, vs) + } + + for item in match: + + k, v = item.split(":", 1) + + # Multiline value + if v[:3] == " >\n": + self.metadata[k.strip()] = _dedent(v[3:]).strip() + + # Empty value + elif v == "\n": + self.metadata[k.strip()] = "" + + # Structured value + elif v[0] == "\n": + self.metadata[k.strip()] = parse_structured_value(v) + + # Simple value + else: + self.metadata[k.strip()] = v.strip() + + return tail + + _emacs_oneliner_vars_pat = re.compile(r"((?:)?)", re.UNICODE) + # This regular expression is intended to match blocks like this: + # PREFIX Local Variables: SUFFIX + # PREFIX mode: Tcl SUFFIX + # PREFIX End: SUFFIX + # Some notes: + # - "[ \t]" is used instead of "\s" to specifically exclude newlines + # - "(\r\n|\n|\r)" is used instead of "$" because the sre engine does + # not like anything other than Unix-style line terminators. + _emacs_local_vars_pat = re.compile(r"""^ + (?P(?:[^\r\n|\n|\r])*?) + [\ \t]*Local\ Variables:[\ \t]* + (?P.*?)(?:\r\n|\n|\r) + (?P.*?\1End:) + """, re.IGNORECASE | re.MULTILINE | re.DOTALL | re.VERBOSE) + + def _emacs_vars_oneliner_sub(self, match): + if match.group(1).strip() == '-*-' and match.group(4).strip() == '-*-': + lead_ws = re.findall(r'^\s*', match.group(1))[0] + tail_ws = re.findall(r'\s*$', match.group(4))[0] + return '%s%s' % (lead_ws, '-*-', match.group(2).strip(), '-*-', tail_ws) + + start, end = match.span() + return match.string[start: end] + + def _get_emacs_vars(self, text): + """Return a dictionary of emacs-style local variables. + + Parsing is done loosely according to this spec (and according to + some in-practice deviations from this): + http://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html#Specifying-File-Variables + """ + emacs_vars = {} + SIZE = pow(2, 13) # 8kB + + # Search near the start for a '-*-'-style one-liner of variables. + head = text[:SIZE] + if "-*-" in head: + match = self._emacs_oneliner_vars_pat.search(head) + if match: + emacs_vars_str = match.group(2) + assert '\n' not in emacs_vars_str + emacs_var_strs = [s.strip() for s in emacs_vars_str.split(';') + if s.strip()] + if len(emacs_var_strs) == 1 and ':' not in emacs_var_strs[0]: + # While not in the spec, this form is allowed by emacs: + # -*- Tcl -*- + # where the implied "variable" is "mode". This form + # is only allowed if there are no other variables. + emacs_vars["mode"] = emacs_var_strs[0].strip() + else: + for emacs_var_str in emacs_var_strs: + try: + variable, value = emacs_var_str.strip().split(':', 1) + except ValueError: + log.debug("emacs variables error: malformed -*- " + "line: %r", emacs_var_str) + continue + # Lowercase the variable name because Emacs allows "Mode" + # or "mode" or "MoDe", etc. + emacs_vars[variable.lower()] = value.strip() + + tail = text[-SIZE:] + if "Local Variables" in tail: + match = self._emacs_local_vars_pat.search(tail) + if match: + prefix = match.group("prefix") + suffix = match.group("suffix") + lines = match.group("content").splitlines(0) + # print "prefix=%r, suffix=%r, content=%r, lines: %s"\ + # % (prefix, suffix, match.group("content"), lines) + + # Validate the Local Variables block: proper prefix and suffix + # usage. + for i, line in enumerate(lines): + if not line.startswith(prefix): + log.debug("emacs variables error: line '%s' " + "does not use proper prefix '%s'" + % (line, prefix)) + return {} + # Don't validate suffix on last line. Emacs doesn't care, + # neither should we. + if i != len(lines)-1 and not line.endswith(suffix): + log.debug("emacs variables error: line '%s' " + "does not use proper suffix '%s'" + % (line, suffix)) + return {} + + # Parse out one emacs var per line. + continued_for = None + for line in lines[:-1]: # no var on the last line ("PREFIX End:") + if prefix: line = line[len(prefix):] # strip prefix + if suffix: line = line[:-len(suffix)] # strip suffix + line = line.strip() + if continued_for: + variable = continued_for + if line.endswith('\\'): + line = line[:-1].rstrip() + else: + continued_for = None + emacs_vars[variable] += ' ' + line + else: + try: + variable, value = line.split(':', 1) + except ValueError: + log.debug("local variables error: missing colon " + "in local variables entry: '%s'" % line) + continue + # Do NOT lowercase the variable name, because Emacs only + # allows "mode" (and not "Mode", "MoDe", etc.) in this block. + value = value.strip() + if value.endswith('\\'): + value = value[:-1].rstrip() + continued_for = variable + else: + continued_for = None + emacs_vars[variable] = value + + # Unquote values. + for var, val in list(emacs_vars.items()): + if len(val) > 1 and (val.startswith('"') and val.endswith('"') + or val.startswith('"') and val.endswith('"')): + emacs_vars[var] = val[1:-1] + + return emacs_vars + + def _detab_line(self, line): + r"""Recusively convert tabs to spaces in a single line. + + Called from _detab().""" + if '\t' not in line: + return line + chunk1, chunk2 = line.split('\t', 1) + chunk1 += (' ' * (self.tab_width - len(chunk1) % self.tab_width)) + output = chunk1 + chunk2 + return self._detab_line(output) + + def _detab(self, text): + r"""Iterate text line by line and convert tabs to spaces. + + >>> m = Markdown() + >>> m._detab("\tfoo") + ' foo' + >>> m._detab(" \tfoo") + ' foo' + >>> m._detab("\t foo") + ' foo' + >>> m._detab(" foo") + ' foo' + >>> m._detab(" foo\n\tbar\tblam") + ' foo\n bar blam' + """ + if '\t' not in text: + return text + output = [] + for line in text.splitlines(): + output.append(self._detab_line(line)) + return '\n'.join(output) + + # I broke out the html5 tags here and add them to _block_tags_a and + # _block_tags_b. This way html5 tags are easy to keep track of. + _html5tags = '|article|aside|header|hgroup|footer|nav|section|figure|figcaption' + + _block_tags_a = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del|style' + _block_tags_a += _html5tags + + _strict_tag_block_re = re.compile(r""" + ( # save in \1 + ^ # start of line (with re.M) + <(%s) # start tag = \2 + \b # word break + (.*\n)*? # any number of lines, minimally matching + # the matching end tag + [ \t]* # trailing spaces/tabs + (?=\n+|\Z) # followed by a newline or end of document + ) + """ % _block_tags_a, + re.X | re.M) + + _block_tags_b = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math' + _block_tags_b += _html5tags + + _span_tags = ( + 'a|abbr|acronym|b|bdo|big|br|button|cite|code|dfn|em|i|img|input|kbd|label|map|object|output|q' + '|samp|script|select|small|span|strong|sub|sup|textarea|time|tt|var' + ) + + _liberal_tag_block_re = re.compile(r""" + ( # save in \1 + ^ # start of line (with re.M) + <(%s) # start tag = \2 + \b # word break + (.*\n)*? # any number of lines, minimally matching + .* # the matching end tag + [ \t]* # trailing spaces/tabs + (?=\n+|\Z) # followed by a newline or end of document + ) + """ % _block_tags_b, + re.X | re.M) + + _html_markdown_attr_re = re.compile( + r'''\s+markdown=("1"|'1')''') + def _hash_html_block_sub(self, match, raw=False): + if isinstance(match, str): + html = match + tag = None + else: + html = match.group(1) + try: + tag = match.group(2) + except IndexError: + tag = None + + tag = tag or re.match(r'.*?<(\S).*?>', html).group(1) + + if raw and self.safe_mode: + html = self._sanitize_html(html) + elif 'markdown-in-html' in self.extras and 'markdown=' in html: + first_line = html.split('\n', 1)[0] + m = self._html_markdown_attr_re.search(first_line) + if m: + lines = html.split('\n') + # if MD is on same line as opening tag then split across two lines + lines = list(filter(None, (re.split(r'(.*?<%s.*markdown=.*?>)' % tag, lines[0])))) + lines[1:] + # if MD on same line as closing tag, split across two lines + lines = lines[:-1] + list(filter(None, re.split(r'(\s*?.*?$)' % tag, lines[-1]))) + # extract key sections of the match + first_line = lines[0] + middle = '\n'.join(lines[1:-1]) + last_line = lines[-1] + # remove `markdown="1"` attr from tag + first_line = first_line[:m.start()] + first_line[m.end():] + # hash the HTML segments to protect them + f_key = _hash_text(first_line) + self.html_blocks[f_key] = first_line + l_key = _hash_text(last_line) + self.html_blocks[l_key] = last_line + return ''.join(["\n\n", f_key, + "\n\n", middle, "\n\n", + l_key, "\n\n"]) + elif self.extras.get('header-ids', {}).get('mixed') and self._h_tag_re.match(html): + html = self._h_tag_re.sub(self._h_tag_sub, html) + key = _hash_text(html) + self.html_blocks[key] = html + return "\n\n" + key + "\n\n" + + @mark_stage(Stage.HASH_HTML) + def _hash_html_blocks(self, text, raw=False): + """Hashify HTML blocks + + We only want to do this for block-level HTML tags, such as headers, + lists, and tables. That's because we still want to wrap

s around + "paragraphs" that are wrapped in non-block-level tags, such as anchors, + phrase emphasis, and spans. The list of tags we're looking for is + hard-coded. + + @param raw {boolean} indicates if these are raw HTML blocks in + the original source. It makes a difference in "safe" mode. + """ + if '<' not in text: + return text + + # Pass `raw` value into our calls to self._hash_html_block_sub. + hash_html_block_sub = _curry(self._hash_html_block_sub, raw=raw) + + # First, look for nested blocks, e.g.: + #

+ #
+ # tags for inner block must be indented. + #
+ #
+ # + # The outermost tags must start at the left margin for this to match, and + # the inner nested divs must be indented. + # We need to do this before the next, more liberal match, because the next + # match will start at the first `
` and stop at the first `
`. + text = self._strict_tag_block_sub(text, self._block_tags_a, hash_html_block_sub) + + # Now match more liberally, simply from `\n` to `\n` + text = self._liberal_tag_block_re.sub(hash_html_block_sub, text) + + # now do the same for spans that are acting like blocks + # eg: an anchor split over multiple lines for readability + text = self._strict_tag_block_sub( + text, self._span_tags, + # inline elements can't contain block level elements, so only span gamut is required + lambda t: hash_html_block_sub(self._run_span_gamut(t)) + ) + + # Special case just for
. It was easier to make a special + # case than to make the other regex more complicated. + if "", start_idx) + 3 + except ValueError: + break + + # Start position for next comment block search. + start = end_idx + + # Validate whitespace before comment. + if start_idx: + # - Up to `tab_width - 1` spaces before start_idx. + for i in range(self.tab_width - 1): + if text[start_idx - 1] != ' ': + break + start_idx -= 1 + if start_idx == 0: + break + # - Must be preceded by 2 newlines or hit the start of + # the document. + if start_idx == 0: + pass + elif start_idx == 1 and text[0] == '\n': + start_idx = 0 # to match minute detail of Markdown.pl regex + elif text[start_idx-2:start_idx] == '\n\n': + pass + else: + break + + # Validate whitespace after comment. + # - Any number of spaces and tabs. + while end_idx < len(text): + if text[end_idx] not in ' \t': + break + end_idx += 1 + # - Must be following by 2 newlines or hit end of text. + if text[end_idx:end_idx+2] not in ('', '\n', '\n\n'): + continue + + # Escape and hash (must match `_hash_html_block_sub`). + html = text[start_idx:end_idx] + if raw and self.safe_mode: + html = self._sanitize_html(html) + key = _hash_text(html) + self.html_blocks[key] = html + text = text[:start_idx] + "\n\n" + key + "\n\n" + text[end_idx:] + + if "xml" in self.extras: + # Treat XML processing instructions and namespaced one-liner + # tags as if they were block HTML tags. E.g., if standalone + # (i.e. are their own paragraph), the following do not get + # wrapped in a
{% block body %}{% endblock %} +
diff --git a/templates/index.html b/templates/index.html index 9f68a00..cf2ca69 100644 --- a/templates/index.html +++ b/templates/index.html @@ -6,7 +6,7 @@
{{ content}} -

Recent Posts

+

Recent Posts

    {% for post in posts[:5] %}
  • {{ post.title }}
  • diff --git a/templates/post.html b/templates/post.html index 994b661..5bb2b97 100644 --- a/templates/post.html +++ b/templates/post.html @@ -14,14 +14,13 @@ {% block twimage %}{{content.metadata.image_link}}{% endblock %} {% block body %} -
    - +
    {{ content}} +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    {% endblock %} diff --git a/templates/sidebar.html b/templates/sidebar.html new file mode 100644 index 0000000..57066ae --- /dev/null +++ b/templates/sidebar.html @@ -0,0 +1,17 @@ + -- cgit v1.2.3 From af4e8e03bedba5c9b6e1206ddfe97ebb77e87d49 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Wed, 27 Mar 2024 22:49:24 -0600 Subject: add colophon section --- Content/colophon/index.md | 8 ++++++++ Content/index.md | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 Content/colophon/index.md diff --git a/Content/colophon/index.md b/Content/colophon/index.md new file mode 100644 index 0000000..80904b2 --- /dev/null +++ b/Content/colophon/index.md @@ -0,0 +1,8 @@ +# Colophon + +This website is generated using a custom static site generator I wrote in Python. The theme is a port of [@mdo's Hyde](http://hyde.getpoole.com/), ported by the makers of [Zola](https://www.getzola.org/). + +All the Open Graph images are generated using Pillow and the Futura font. The math is taken care of by an extra I created for the python-markdown2 library that converts inline and block $\LaTeX$ into MathML. + +Since this website is currently using the `.dev` tld, there is no support for HTTP in most browsers (Since they use HSTS preloading). But if you ever find yourself on an IBM PC 5150 and need to use `hget`, that should work. + diff --git a/Content/index.md b/Content/index.md index fb22d38..b85aa59 100644 --- a/Content/index.md +++ b/Content/index.md @@ -1 +1,6 @@ -# Navan Chauhan +# Some Projects + +* [iGopherBrowser](https://web.navan.dev/iGopherBrowser): A modern Gopher client for iOS, macOS, and VisionOS. It is built on top of my [swift-gopher](https://github.com/swift-gopher) library. Available on the [App Store](https://apps.apple.com/in/app/igopherbrowser/id647463884) +* [TimeSlicerX](https://timeslicerx.prudent.studio): A timeboxing app for iOS (and macOS) to schedule tasks around your calendar items. Everything is done on-device. Available on the [App Store](https://apps.apple.com/us/app/timeslicerx/id6447939029?uo=4) +* [VaporwaveGenerator](https://github.com/navanchauhan/VaporwaveGenerator): A E S T H E T I C S + -- cgit v1.2.3 From 01ff93c9c16867216f2d249664803860e1d6d5eb Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Wed, 27 Mar 2024 22:49:40 -0600 Subject: generate new theme --- Resources/assets/c-hyde.css | 706 +++++++++++++++++++++ Resources/assets/c-hyde.css.map | 1 + .../2024-02-17-Can-Holder-Mountain-Bike.html | 55 +- docs/3D-Designs/index.html | 50 +- docs/about/index.html | 50 +- docs/assets/c-hyde.css | 706 +++++++++++++++++++++ docs/assets/c-hyde.css.map | 1 + docs/assets/resume.pdf | Bin 39327 -> 0 bytes docs/colophon/index.html | 85 +++ docs/feed.rss | 4 +- docs/ideas/2022-12-17-ar-mr-xr.html | 55 +- docs/ideas/index.html | 50 +- docs/index.html | 60 +- docs/posts/2010-01-24-experiments.html | 55 +- .../2019-05-05-Custom-Snowboard-Anemone-Theme.html | 55 +- .../2019-12-04-Google-Teachable-Machines.html | 55 +- .../2019-12-08-Image-Classifier-Tensorflow.html | 55 +- docs/posts/2019-12-08-Splitting-Zips.html | 55 +- .../2019-12-10-TensorFlow-Model-Prediction.html | 55 +- ...019-12-16-TensorFlow-Polynomial-Regression.html | 55 +- docs/posts/2019-12-22-Fake-News-Detector.html | 55 +- .../2020-01-14-Converting-between-PIL-NumPy.html | 55 +- ...-01-15-Setting-up-Kaggle-to-use-with-Colab.html | 55 +- ...20-01-16-Image-Classifier-Using-Turicreate.html | 55 +- ...onnect-To-Bluetooth-Devices-Linux-Terminal.html | 55 +- docs/posts/2020-03-03-Playing-With-Android-TV.html | 55 +- docs/posts/2020-03-08-Making-Vaporwave-Track.html | 55 +- ...20-04-13-Fixing-X11-Error-AmberTools-macOS.html | 55 +- .../2020-05-31-compiling-open-babel-on-ios.html | 55 +- ...r-Docking-Workflow-AutoDock-Vina-and-PyMOL.html | 55 +- .../2020-06-02-Compiling-AutoDock-Vina-on-iOS.html | 55 +- docs/posts/2020-07-01-Install-rdkit-colab.html | 55 +- .../2020-08-01-Natural-Feature-Tracking-ARJS.html | 55 +- docs/posts/2020-10-11-macOS-Virtual-Cam-OBS.html | 55 +- docs/posts/2020-11-17-Lets-Encrypt-DuckDns.html | 55 +- docs/posts/2020-12-1-HTML-JS-RSS-Feed.html | 55 +- docs/posts/2021-06-25-Blog2Twitter-P1.html | 55 +- .../2021-06-25-NFC-Music-Cards-Basic-iOS.html | 55 +- ...2021-06-26-Cheminformatics-On-The-Web-2021.html | 55 +- ...21-06-27-Crude-ML-AI-Powered-Chatbot-Swift.html | 55 +- .../2022-05-21-Similar-Movies-Recommender.html | 55 +- docs/posts/2022-08-05-Why-You-No-Host.html | 55 +- docs/posts/2022-11-07-a-new-method-to-blog.html | 55 +- docs/posts/2022-12-25-blog-to-toot.html | 55 +- ...02-08-Interact-with-siri-from-the-terminal.html | 55 +- docs/posts/2023-03-17-future-of-writing.html | 81 --- docs/posts/2023-04-30-n-body-simulation.html | 55 +- docs/posts/2023-10-04-bomb-lab.html | 55 +- docs/posts/2023-10-05-attack-lab.html | 55 +- docs/posts/2023-10-22-search-by-flair-reddit.html | 55 +- docs/posts/2024-01-05-hello-20224.html | 55 +- ...rol-element-under-another-element-html-css.html | 55 +- ...24-03-15-setting-up-macos-for-8088-dos-dev.html | 55 +- ...3-21-Polynomial-Regression-in-TensorFlow-2.html | 55 +- ...03-26-Derivation-of-the-Quadratic-Equation.html | 55 +- docs/posts/hello-world.html | 55 +- docs/posts/index.html | 50 +- ...ing-and-Speeding-up-Post-Accident-Response.html | 55 +- .../2020-03-14-generating-vaporwave.html | 55 +- ...20-03-17-Possible-Drug-Candidates-COVID-19.html | 55 +- docs/publications/index.html | 50 +- docs/tags/AR.html | 50 +- docs/tags/AR.js.html | 50 +- docs/tags/Android-TV.html | 50 +- docs/tags/Android.html | 50 +- docs/tags/Anemone.html | 50 +- docs/tags/AppleScript.html | 50 +- docs/tags/Augmented-Reality.html | 50 +- docs/tags/AutoDock Vina.html | 50 +- docs/tags/CSS.html | 50 +- docs/tags/Cheminformatics.html | 50 +- docs/tags/Code-Snippet.html | 50 +- docs/tags/Colab.html | 50 +- docs/tags/CoreML.html | 50 +- docs/tags/DOS.html | 50 +- docs/tags/Designing.html | 50 +- docs/tags/Eh.html | 50 +- docs/tags/Experiment.html | 50 +- docs/tags/Fun.html | 50 +- docs/tags/General.html | 50 +- docs/tags/HTML.html | 50 +- docs/tags/JS.html | 73 --- docs/tags/Jailbreak.html | 50 +- docs/tags/JavaScript.html | 50 +- docs/tags/Just Beer Things.html | 72 --- docs/tags/Kaggle.html | 50 +- docs/tags/Linux.html | 50 +- docs/tags/MR.html | 50 +- docs/tags/Mastodon.html | 50 +- docs/tags/Microsoft Azure.html | 50 +- docs/tags/Molecular-Docking.html | 50 +- docs/tags/Molecular-Dynamics.html | 50 +- docs/tags/Mountain Biking.html | 50 +- docs/tags/Music.html | 50 +- docs/tags/NLP.html | 50 +- docs/tags/OCR.html | 50 +- docs/tags/Open-Babel.html | 50 +- docs/tags/OpenCV.html | 73 --- docs/tags/OpenSCAD.html | 50 +- docs/tags/Python.html | 50 +- docs/tags/Raspberry-Pi.html | 50 +- docs/tags/Recommendation-System.html | 50 +- docs/tags/Reddit.html | 50 +- docs/tags/Review.html | 50 +- docs/tags/Self-Hosted.html | 50 +- docs/tags/Shortcuts.html | 50 +- docs/tags/Siri.html | 50 +- docs/tags/Snowboard.html | 50 +- docs/tags/Swift.html | 50 +- docs/tags/SwiftUI.html | 50 +- docs/tags/Tech Tip.html | 50 +- docs/tags/Tensorflow.html | 50 +- docs/tags/Transformers.html | 50 +- docs/tags/Turicreate.html | 50 +- docs/tags/Tutorial.html | 50 +- docs/tags/Twitter.html | 50 +- docs/tags/Vaporwave.html | 50 +- docs/tags/Web-Development.html | 50 +- docs/tags/Webcam.html | 50 +- docs/tags/XR.html | 50 +- docs/tags/YunoHost.html | 50 +- docs/tags/assembly.html | 50 +- docs/tags/astrophysics.html | 50 +- docs/tags/c++.html | 50 +- docs/tags/csci2400.html | 50 +- docs/tags/gdb.html | 50 +- docs/tags/hello-world.html | 50 +- docs/tags/iOS.html | 50 +- docs/tags/macOS.html | 50 +- docs/tags/mathematics.html | 50 +- docs/tags/pre-print.html | 50 +- docs/tags/publication.html | 50 +- docs/tags/ramblings.html | 50 +- docs/tags/reverse-engineering.html | 50 +- docs/tags/writing.html | 70 -- docs/tags/x86.html | 50 +- 136 files changed, 5943 insertions(+), 2374 deletions(-) create mode 100644 Resources/assets/c-hyde.css create mode 100644 Resources/assets/c-hyde.css.map create mode 100644 docs/assets/c-hyde.css create mode 100644 docs/assets/c-hyde.css.map delete mode 100644 docs/assets/resume.pdf create mode 100644 docs/colophon/index.html delete mode 100644 docs/posts/2023-03-17-future-of-writing.html delete mode 100644 docs/tags/JS.html delete mode 100644 docs/tags/Just Beer Things.html delete mode 100644 docs/tags/OpenCV.html delete mode 100644 docs/tags/writing.html diff --git a/Resources/assets/c-hyde.css b/Resources/assets/c-hyde.css new file mode 100644 index 0000000..e452bbc --- /dev/null +++ b/Resources/assets/c-hyde.css @@ -0,0 +1,706 @@ +/* +Port of @mdo's Hyde Theme by Zola + +MIT License + +Copyright (c) 2017 Vincent Prouillet + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +/* + * ___ + * /\_ \ + * _____ ___ ___\//\ \ __ + * /\ '__`\ / __`\ / __`\\ \ \ /'__`\ + * \ \ \_\ \/\ \_\ \/\ \_\ \\_\ \_/\ __/ + * \ \ ,__/\ \____/\ \____//\____\ \____\ + * \ \ \/ \/___/ \/___/ \/____/\/____/ + * \ \_\ + * \/_/ + * + * Designed, built, and released under MIT license by @mdo. Learn more at + * https://github.com/poole/poole. + */ +/* + * Contents + * + * Body resets + * Custom type + * Messages + * Container + * Masthead + * Posts and pages + * Footnotes + * Pagination + * Reverse layout + * Themes + */ +/* + * Body resets + * + * Update the foundational and global aspects of the page. + */ +* { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +html, +body { + margin: 0; + padding: 0; +} + +html { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 16px; + line-height: 1.5; +} + +@media (min-width: 38em) { + html { + font-size: 20px; + } +} +body { + color: #515151; + background-color: #fff; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; +} + +/* No `:visited` state is required by default (browsers will use `a`) */ +a { + color: #268bd2; + text-decoration: none; +} + +/* `:focus` is linked to `:hover` for basic accessibility */ +a:hover, +a:focus { + text-decoration: underline; +} + +/* Headings */ +h1, h2, h3, h4, h5, h6 { + margin-bottom: 0.5rem; + font-weight: bold; + line-height: 1.25; + color: #313131; + text-rendering: optimizeLegibility; +} + +h1 { + font-size: 2rem; +} + +h2 { + margin-top: 1rem; + font-size: 1.5rem; +} + +h3 { + margin-top: 1.5rem; + font-size: 1.25rem; +} + +h4, h5, h6 { + margin-top: 1rem; + font-size: 1rem; +} + +/* Body text */ +p { + margin-top: 0; + margin-bottom: 1rem; +} + +strong { + color: #303030; +} + +/* Lists */ +ul, ol, dl { + margin-top: 0; + margin-bottom: 1rem; +} + +dt { + font-weight: bold; +} + +dd { + margin-bottom: 0.5rem; +} + +/* Misc */ +hr { + position: relative; + margin: 1.5rem 0; + border: 0; + border-top: 1px solid #eee; + border-bottom: 1px solid #fff; +} + +abbr { + font-size: 85%; + font-weight: bold; + color: #555; + text-transform: uppercase; +} + +abbr[title] { + cursor: help; + border-bottom: 1px dotted #e5e5e5; +} + +/* Code */ +code, +pre { + font-family: Menlo, Monaco, "Courier New", monospace; +} + +code { + padding: 0.25em 0.5em; + font-size: 85%; + color: #bf616a; + background-color: #f9f9f9; + border-radius: 3px; +} + +pre { + display: block; + margin-top: 0; + margin-bottom: 1rem; + padding: 1rem; + font-size: 0.8rem; + line-height: 1.4; + overflow-x: scroll; + background-color: #f9f9f9; +} + +pre code { + padding: 0; + font-size: 100%; + color: inherit; + background-color: transparent; +} + +.highlight { + margin-bottom: 1rem; + border-radius: 4px; +} + +.highlight pre { + margin-bottom: 0; +} + +/* Quotes */ +blockquote { + padding: 0.5rem 1rem; + margin: 0.8rem 0; + color: #7a7a7a; + border-left: 0.25rem solid #e5e5e5; +} + +blockquote p:last-child { + margin-bottom: 0; +} + +@media (min-width: 30em) { + blockquote { + padding-right: 5rem; + padding-left: 1.25rem; + } +} +img { + display: block; + margin: 0 0 1rem; + border-radius: 5px; + max-width: 100%; +} + +/* Tables */ +table { + margin-bottom: 1rem; + width: 100%; + border: 1px solid #e5e5e5; + border-collapse: collapse; +} + +td, +th { + padding: 0.25rem 0.5rem; + border: 1px solid #e5e5e5; +} + +tbody tr:nth-child(odd) td, +tbody tr:nth-child(odd) th { + background-color: #f9f9f9; +} + +/* + * Custom type + * + * Extend paragraphs with `.lead` for larger introductory text. + */ +.lead { + font-size: 1.25rem; + font-weight: 300; +} + +/* + * Messages + * + * Show alert messages to users. You may add it to single elements like a `

    `, + * or to a parent if there are multiple elements to show. + */ +.message { + margin-bottom: 1rem; + padding: 1rem; + color: #717171; + background-color: #f9f9f9; +} + +/* + * Container + * + * Center the page content. + */ +.container { + max-width: 38rem; + padding-left: 1rem; + padding-right: 1rem; + margin-left: auto; + margin-right: auto; +} + +/* + * Masthead + * + * Super small header above the content for site name and short description. + */ +.masthead { + padding-top: 1rem; + padding-bottom: 1rem; + margin-bottom: 3rem; +} + +.masthead-title { + margin-top: 0; + margin-bottom: 0; + color: #505050; +} + +.masthead-title a { + color: #505050; +} + +.masthead-title small { + font-size: 75%; + font-weight: 400; + color: #c0c0c0; + letter-spacing: 0; +} + +/* + * Posts and pages + * + * Each post is wrapped in `.post` and is used on default and post layouts. Each + * page is wrapped in `.page` and is only used on the page layout. + */ +.page, +.post { + margin-bottom: 4em; +} + +/* Blog post or page title */ +.page-title, +.post-title, +.post-title a { + color: #303030; +} + +.page-title, +.post-title { + margin-top: 0; +} + +/* Meta data line below post title */ +.post-date { + display: block; + margin-top: -0.5rem; + margin-bottom: 1rem; + color: #9a9a9a; +} + +/* Related posts */ +.related { + padding-top: 2rem; + padding-bottom: 2rem; + border-top: 1px solid #eee; +} + +.related-posts { + padding-left: 0; + list-style: none; +} + +.related-posts h3 { + margin-top: 0; +} + +.related-posts li small { + font-size: 75%; + color: #999; +} + +.related-posts li a:hover { + color: #268bd2; + text-decoration: none; +} + +.related-posts li a:hover small { + color: inherit; +} + +/* Footnotes */ +.footnote-definition:first-of-type { + border-top: 1px solid; + padding-top: 1rem; +} + +.footnote-definition { + margin-top: 1rem; +} + +.footnote-definition sup { + margin-left: -1rem; + float: left; +} + +/* + * Pagination + * + * Super lightweight (HTML-wise) blog pagination. `span`s are provide for when + * there are no more previous or next posts to show. + */ +.pagination { + overflow: hidden; /* clearfix */ + margin-left: -1rem; + margin-right: -1rem; + font-family: "PT Sans", Helvetica, Arial, sans-serif; + color: #ccc; + text-align: center; +} + +/* Pagination items can be `span`s or `a`s */ +.pagination-item { + display: block; + padding: 1rem; + border: 1px solid #eee; +} + +.pagination-item:first-child { + margin-bottom: -1px; +} + +/* Only provide a hover state for linked pagination items */ +a.pagination-item:hover { + background-color: #f5f5f5; +} + +@media (min-width: 30em) { + .pagination { + margin: 3rem 0; + } + .pagination-item { + float: left; + width: 50%; + } + .pagination-item:first-child { + margin-bottom: 0; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + } + .pagination-item:last-child { + margin-left: -1px; + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + } +} +/* + * __ __ + * /\ \ /\ \ + * \ \ \___ __ __ \_\ \ __ + * \ \ _ `\/\ \/\ \ /'_` \ /'__`\ + * \ \ \ \ \ \ \_\ \/\ \_\ \/\ __/ + * \ \_\ \_\/`____ \ \___,_\ \____\ + * \/_/\/_/`/___/> \/__,_ /\/____/ + * /\___/ + * \/__/ + * + * Designed, built, and released under MIT license by @mdo. Learn more at + * https://github.com/poole/hyde. + */ +/* + * Contents + * + * Global resets + * Sidebar + * Container + * Reverse layout + * Themes + */ +/* + * Global resets + * + * Update the foundational and global aspects of the page. + */ +html { + font-family: "PT Sans", Helvetica, Arial, sans-serif; +} + +@media (min-width: 48em) { + html { + font-size: 16px; + } +} +@media (min-width: 58em) { + html { + font-size: 20px; + } +} +/* + * Sidebar + * + * Flexible banner for housing site name, intro, and "footer" content. Starts + * out above content in mobile and later moves to the side with wider viewports. + */ +.sidebar { + text-align: center; + padding: 2rem 1rem; + color: rgba(255, 255, 255, 0.5); + background-color: #202020; +} + +@media (min-width: 48em) { + .sidebar { + position: fixed; + top: 0; + left: 0; + bottom: 0; + width: 18rem; + text-align: left; + } +} +/* Sidebar links */ +.sidebar a { + color: #fff; +} + +/* About section */ +.sidebar-about h1 { + color: #fff; + margin-top: 0; + font-family: "Abril Fatface", serif; + font-size: 3.25rem; +} + +/* Sidebar nav */ +.sidebar-nav { + padding-left: 0; + list-style: none; +} + +.sidebar-nav-item { + display: block; +} + +a.sidebar-nav-item:hover, +a.sidebar-nav-item:focus { + text-decoration: underline; +} + +.sidebar-nav-item.active { + font-weight: bold; +} + +/* Sticky sidebar + * + * Add the `sidebar-sticky` class to the sidebar's container to affix it the + * contents to the bottom of the sidebar in tablets and up. + */ +@media (min-width: 48em) { + .sidebar-sticky { + position: absolute; + right: 1rem; + bottom: 1rem; + left: 1rem; + } + @supports (padding: max(0px)) { + body:not(.layout-reverse) .sidebar-sticky { + padding-left: max(1rem, env(safe-area-inset-left)); + } + .layout-reverse .sidebar-sticky { + padding-right: max(1rem, env(safe-area-inset-right)); + } + } +} +/* Container + * + * Align the contents of the site above the proper threshold with some margin-fu + * with a 25%-wide `.sidebar`. + */ +.content { + padding-top: 4rem; + padding-bottom: 4rem; +} + +@supports (padding: max(0px)) { + body:not(.layout-reverse) .content { + padding-right: max(1rem, env(safe-area-inset-right)); + } + .layout-reverse .content { + padding-left: max(1rem, env(safe-area-inset-left)); + } +} +@media (min-width: 48em) { + .content { + max-width: 38rem; + margin-left: 20rem; + margin-right: 2rem; + } +} +@media (min-width: 64em) { + .content { + margin-left: 22rem; + margin-right: 4rem; + } +} +/* + * Reverse layout + * + * Flip the orientation of the page by placing the `.sidebar` on the right. + */ +@media (min-width: 48em) { + .layout-reverse .sidebar { + left: auto; + right: 0; + } + .layout-reverse .content { + margin-left: 2rem; + margin-right: 20rem; + } +} +@media (min-width: 64em) { + .layout-reverse .content { + margin-left: 4rem; + margin-right: 22rem; + } +} +/* + * Themes + * + * As of v1.1, Hyde includes optional themes to color the sidebar and links + * within blog posts. To use, add the class of your choosing to the `body`. + */ +/* Base16 (http://chriskempson.github.io/base16/#default) */ +/* Red */ +.theme-base-08 .sidebar { + background-color: #ac4142; +} + +.theme-base-08 .content a, +.theme-base-08 .related-posts li a:hover { + color: #ac4142; +} + +/* Orange */ +.theme-base-09 .sidebar { + background-color: #d28445; +} + +.theme-base-09 .content a, +.theme-base-09 .related-posts li a:hover { + color: #d28445; +} + +/* Yellow */ +.theme-base-0a .sidebar { + background-color: #f4bf75; +} + +.theme-base-0a .content a, +.theme-base-0a .related-posts li a:hover { + color: #f4bf75; +} + +/* Green */ +.theme-base-0b .sidebar { + background-color: #90a959; +} + +.theme-base-0b .content a, +.theme-base-0b .related-posts li a:hover { + color: #90a959; +} + +/* Cyan */ +.theme-base-0c .sidebar { + background-color: #75b5aa; +} + +.theme-base-0c .content a, +.theme-base-0c .related-posts li a:hover { + color: #75b5aa; +} + +/* Blue */ +.theme-base-0d .sidebar { + background-color: #6a9fb5; +} + +.theme-base-0d .content a, +.theme-base-0d .related-posts li a:hover { + color: #6a9fb5; +} + +/* Magenta */ +.theme-base-0e .sidebar { + background-color: #aa759f; +} + +.theme-base-0e .content a, +.theme-base-0e .related-posts li a:hover { + color: #aa759f; +} + +/* Brown */ +.theme-base-0f .sidebar { + background-color: #8f5536; +} + +.theme-base-0f .content a, +.theme-base-0f .related-posts li a:hover { + color: #8f5536; +} + +/*# sourceMappingURL=c-hyde.css.map */ diff --git a/Resources/assets/c-hyde.css.map b/Resources/assets/c-hyde.css.map new file mode 100644 index 0000000..dd72137 --- /dev/null +++ b/Resources/assets/c-hyde.css.map @@ -0,0 +1 @@ +{"version":3,"sourceRoot":"","sources":["../../sass/c-hyde.scss"],"names":[],"mappings":"AAAA;AAAA;;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA;AAAA;AAAA;AAAA;AAAA;AAMA;EACE;EACG;EACK;;;AAGV;AAAA;EAEE;EACA;;;AAGF;EACE;EACA;EACA;;;AAEF;EACE;IACE;;;AAIJ;EACE;EACA;EACA;EACI;;;AAGN;AACA;EACE;EACA;;;AAEF;AACA;AAAA;EAEE;;;AAGF;AACA;EACE;EACA;EACA;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;AAGF;AACA;EACE;EACA;;;AAGF;EACE;;;AAIF;AACA;EACE;EACA;;;AAGF;EACE;;;AAEF;EACE;;;AAGF;AACA;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAEF;EACE;EACA;;;AAGF;AACA;AAAA;EAEE;;;AAEF;EACE;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;;;AAGF;AACA;EACE;EACA;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;IACE;IACA;;;AAIJ;EACE;EACA;EACA;EACA;;;AAGF;AACA;EACE;EACA;EACA;EACA;;;AAEF;AAAA;EAEE;EACA;;;AAEF;AAAA;EAEE;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAMA;EACE;EACA;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;EACE;EACA;EACA;EACA;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAMA;EACE;EACA;EACA;EACA;EACA;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAMA;EACE;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;EACA;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;AAAA;EAEE;;;AAGF;AACA;AAAA;AAAA;EAGE;;;AAEF;AAAA;EAEE;;;AAGF;AACA;EACE;EACA;EACA;EACA;;;AAGF;AACA;EACE;EACA;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;;;AAIF;AACA;EACE;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;EACE;EACA;EACA;EACA;EACA;EACA;;;AAGF;AACA;EACE;EACA;EACA;;;AAEF;EACE;;;AAGF;AACA;EACE;;;AAGF;EACE;IACE;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA;;EAEF;IACE;IACA;IACA;;;AAIJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA;AAAA;AAAA;AAAA;AAAA;AAMA;EACE;;;AAEF;EACE;IACE;;;AAGJ;EACE;IACE;;;AAKJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;EACE;EACA;EACA;EACA;;;AAEF;EACE;IACE;IACA;IACA;IACA;IACA;IACA;;;AAIJ;AACA;EACE;;;AAGF;AACA;EACE;EACA;EACA;EACA;;;AAGF;AACA;EACE;EACA;;;AAEF;EACE;;;AAEF;AAAA;EAEE;;;AAEF;EACE;;;AAGF;AAAA;AAAA;AAAA;AAAA;AAMA;EACE;IACE;IACA;IACA;IACA;;EAIF;IACE;MAEI;;IAGJ;MAGI;;;;AAMR;AAAA;AAAA;AAAA;AAAA;AAMA;EACE;EACA;;;AAGF;EACE;IAEI;;EAGJ;IAEI;;;AAKN;EACE;IACE;IACA;IACA;;;AAIJ;EACE;IACE;IACA;;;AAKJ;AAAA;AAAA;AAAA;AAAA;AAMA;EACE;IACE;IACA;;EAEF;IACE;IACA;;;AAIJ;EACE;IACE;IACA;;;AAMJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;AAEA;AACA;EACE;;;AAEF;AAAA;EAEE;;;AAGF;AACA;EACE;;;AAEF;AAAA;EAEE;;;AAGF;AACA;EACE;;;AAEF;AAAA;EAEE;;;AAGF;AACA;EACE;;;AAEF;AAAA;EAEE;;;AAGF;AACA;EACE;;;AAEF;AAAA;EAEE;;;AAGF;AACA;EACE;;;AAEF;AAAA;EAEE;;;AAGF;AACA;EACE;;;AAEF;AAAA;EAEE;;;AAGF;AACA;EACE;;;AAEF;AAAA;EAEE","file":"c-hyde.css"} \ No newline at end of file diff --git a/docs/3D-Designs/2024-02-17-Can-Holder-Mountain-Bike.html b/docs/3D-Designs/2024-02-17-Can-Holder-Mountain-Bike.html index 9b1b6cd..0afa31d 100644 --- a/docs/3D-Designs/2024-02-17-Can-Holder-Mountain-Bike.html +++ b/docs/3D-Designs/2024-02-17-Can-Holder-Mountain-Bike.html @@ -2,14 +2,26 @@ - + + + + + Bike Soda Can Holder + + + + + + + - Bike Soda Can Holder - @@ -29,21 +41,27 @@ - -

    -
    - -
    + + +
    + +

    Bike Soda Can Holder

    Ever wanted a nice craft soda, or a natty light during your ride? Mounts to the standard bottle cage holes on your bike.

    @@ -78,14 +96,15 @@ model-viewer {

    The OpenSCAD code can be modified to support tall boys and stovepipe cans. Email me if you need help generating more variations

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    + diff --git a/docs/3D-Designs/index.html b/docs/3D-Designs/index.html index 1f46130..c50addc 100644 --- a/docs/3D-Designs/index.html +++ b/docs/3D-Designs/index.html @@ -2,14 +2,26 @@ - + + + + + 3D-Designs + + + + + + + - 3D-Designs - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -68,6 +87,7 @@
+ diff --git a/docs/about/index.html b/docs/about/index.html index 3608be0..d861f73 100644 --- a/docs/about/index.html +++ b/docs/about/index.html @@ -2,14 +2,26 @@ - + + + + + About + + + + + + + - About - @@ -29,18 +41,25 @@ - -
-
+ + +
@@ -77,6 +96,7 @@ +
diff --git a/docs/assets/c-hyde.css b/docs/assets/c-hyde.css new file mode 100644 index 0000000..e452bbc --- /dev/null +++ b/docs/assets/c-hyde.css @@ -0,0 +1,706 @@ +/* +Port of @mdo's Hyde Theme by Zola + +MIT License + +Copyright (c) 2017 Vincent Prouillet + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +/* + * ___ + * /\_ \ + * _____ ___ ___\//\ \ __ + * /\ '__`\ / __`\ / __`\\ \ \ /'__`\ + * \ \ \_\ \/\ \_\ \/\ \_\ \\_\ \_/\ __/ + * \ \ ,__/\ \____/\ \____//\____\ \____\ + * \ \ \/ \/___/ \/___/ \/____/\/____/ + * \ \_\ + * \/_/ + * + * Designed, built, and released under MIT license by @mdo. Learn more at + * https://github.com/poole/poole. + */ +/* + * Contents + * + * Body resets + * Custom type + * Messages + * Container + * Masthead + * Posts and pages + * Footnotes + * Pagination + * Reverse layout + * Themes + */ +/* + * Body resets + * + * Update the foundational and global aspects of the page. + */ +* { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +html, +body { + margin: 0; + padding: 0; +} + +html { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 16px; + line-height: 1.5; +} + +@media (min-width: 38em) { + html { + font-size: 20px; + } +} +body { + color: #515151; + background-color: #fff; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; +} + +/* No `:visited` state is required by default (browsers will use `a`) */ +a { + color: #268bd2; + text-decoration: none; +} + +/* `:focus` is linked to `:hover` for basic accessibility */ +a:hover, +a:focus { + text-decoration: underline; +} + +/* Headings */ +h1, h2, h3, h4, h5, h6 { + margin-bottom: 0.5rem; + font-weight: bold; + line-height: 1.25; + color: #313131; + text-rendering: optimizeLegibility; +} + +h1 { + font-size: 2rem; +} + +h2 { + margin-top: 1rem; + font-size: 1.5rem; +} + +h3 { + margin-top: 1.5rem; + font-size: 1.25rem; +} + +h4, h5, h6 { + margin-top: 1rem; + font-size: 1rem; +} + +/* Body text */ +p { + margin-top: 0; + margin-bottom: 1rem; +} + +strong { + color: #303030; +} + +/* Lists */ +ul, ol, dl { + margin-top: 0; + margin-bottom: 1rem; +} + +dt { + font-weight: bold; +} + +dd { + margin-bottom: 0.5rem; +} + +/* Misc */ +hr { + position: relative; + margin: 1.5rem 0; + border: 0; + border-top: 1px solid #eee; + border-bottom: 1px solid #fff; +} + +abbr { + font-size: 85%; + font-weight: bold; + color: #555; + text-transform: uppercase; +} + +abbr[title] { + cursor: help; + border-bottom: 1px dotted #e5e5e5; +} + +/* Code */ +code, +pre { + font-family: Menlo, Monaco, "Courier New", monospace; +} + +code { + padding: 0.25em 0.5em; + font-size: 85%; + color: #bf616a; + background-color: #f9f9f9; + border-radius: 3px; +} + +pre { + display: block; + margin-top: 0; + margin-bottom: 1rem; + padding: 1rem; + font-size: 0.8rem; + line-height: 1.4; + overflow-x: scroll; + background-color: #f9f9f9; +} + +pre code { + padding: 0; + font-size: 100%; + color: inherit; + background-color: transparent; +} + +.highlight { + margin-bottom: 1rem; + border-radius: 4px; +} + +.highlight pre { + margin-bottom: 0; +} + +/* Quotes */ +blockquote { + padding: 0.5rem 1rem; + margin: 0.8rem 0; + color: #7a7a7a; + border-left: 0.25rem solid #e5e5e5; +} + +blockquote p:last-child { + margin-bottom: 0; +} + +@media (min-width: 30em) { + blockquote { + padding-right: 5rem; + padding-left: 1.25rem; + } +} +img { + display: block; + margin: 0 0 1rem; + border-radius: 5px; + max-width: 100%; +} + +/* Tables */ +table { + margin-bottom: 1rem; + width: 100%; + border: 1px solid #e5e5e5; + border-collapse: collapse; +} + +td, +th { + padding: 0.25rem 0.5rem; + border: 1px solid #e5e5e5; +} + +tbody tr:nth-child(odd) td, +tbody tr:nth-child(odd) th { + background-color: #f9f9f9; +} + +/* + * Custom type + * + * Extend paragraphs with `.lead` for larger introductory text. + */ +.lead { + font-size: 1.25rem; + font-weight: 300; +} + +/* + * Messages + * + * Show alert messages to users. You may add it to single elements like a `

`, + * or to a parent if there are multiple elements to show. + */ +.message { + margin-bottom: 1rem; + padding: 1rem; + color: #717171; + background-color: #f9f9f9; +} + +/* + * Container + * + * Center the page content. + */ +.container { + max-width: 38rem; + padding-left: 1rem; + padding-right: 1rem; + margin-left: auto; + margin-right: auto; +} + +/* + * Masthead + * + * Super small header above the content for site name and short description. + */ +.masthead { + padding-top: 1rem; + padding-bottom: 1rem; + margin-bottom: 3rem; +} + +.masthead-title { + margin-top: 0; + margin-bottom: 0; + color: #505050; +} + +.masthead-title a { + color: #505050; +} + +.masthead-title small { + font-size: 75%; + font-weight: 400; + color: #c0c0c0; + letter-spacing: 0; +} + +/* + * Posts and pages + * + * Each post is wrapped in `.post` and is used on default and post layouts. Each + * page is wrapped in `.page` and is only used on the page layout. + */ +.page, +.post { + margin-bottom: 4em; +} + +/* Blog post or page title */ +.page-title, +.post-title, +.post-title a { + color: #303030; +} + +.page-title, +.post-title { + margin-top: 0; +} + +/* Meta data line below post title */ +.post-date { + display: block; + margin-top: -0.5rem; + margin-bottom: 1rem; + color: #9a9a9a; +} + +/* Related posts */ +.related { + padding-top: 2rem; + padding-bottom: 2rem; + border-top: 1px solid #eee; +} + +.related-posts { + padding-left: 0; + list-style: none; +} + +.related-posts h3 { + margin-top: 0; +} + +.related-posts li small { + font-size: 75%; + color: #999; +} + +.related-posts li a:hover { + color: #268bd2; + text-decoration: none; +} + +.related-posts li a:hover small { + color: inherit; +} + +/* Footnotes */ +.footnote-definition:first-of-type { + border-top: 1px solid; + padding-top: 1rem; +} + +.footnote-definition { + margin-top: 1rem; +} + +.footnote-definition sup { + margin-left: -1rem; + float: left; +} + +/* + * Pagination + * + * Super lightweight (HTML-wise) blog pagination. `span`s are provide for when + * there are no more previous or next posts to show. + */ +.pagination { + overflow: hidden; /* clearfix */ + margin-left: -1rem; + margin-right: -1rem; + font-family: "PT Sans", Helvetica, Arial, sans-serif; + color: #ccc; + text-align: center; +} + +/* Pagination items can be `span`s or `a`s */ +.pagination-item { + display: block; + padding: 1rem; + border: 1px solid #eee; +} + +.pagination-item:first-child { + margin-bottom: -1px; +} + +/* Only provide a hover state for linked pagination items */ +a.pagination-item:hover { + background-color: #f5f5f5; +} + +@media (min-width: 30em) { + .pagination { + margin: 3rem 0; + } + .pagination-item { + float: left; + width: 50%; + } + .pagination-item:first-child { + margin-bottom: 0; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + } + .pagination-item:last-child { + margin-left: -1px; + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + } +} +/* + * __ __ + * /\ \ /\ \ + * \ \ \___ __ __ \_\ \ __ + * \ \ _ `\/\ \/\ \ /'_` \ /'__`\ + * \ \ \ \ \ \ \_\ \/\ \_\ \/\ __/ + * \ \_\ \_\/`____ \ \___,_\ \____\ + * \/_/\/_/`/___/> \/__,_ /\/____/ + * /\___/ + * \/__/ + * + * Designed, built, and released under MIT license by @mdo. Learn more at + * https://github.com/poole/hyde. + */ +/* + * Contents + * + * Global resets + * Sidebar + * Container + * Reverse layout + * Themes + */ +/* + * Global resets + * + * Update the foundational and global aspects of the page. + */ +html { + font-family: "PT Sans", Helvetica, Arial, sans-serif; +} + +@media (min-width: 48em) { + html { + font-size: 16px; + } +} +@media (min-width: 58em) { + html { + font-size: 20px; + } +} +/* + * Sidebar + * + * Flexible banner for housing site name, intro, and "footer" content. Starts + * out above content in mobile and later moves to the side with wider viewports. + */ +.sidebar { + text-align: center; + padding: 2rem 1rem; + color: rgba(255, 255, 255, 0.5); + background-color: #202020; +} + +@media (min-width: 48em) { + .sidebar { + position: fixed; + top: 0; + left: 0; + bottom: 0; + width: 18rem; + text-align: left; + } +} +/* Sidebar links */ +.sidebar a { + color: #fff; +} + +/* About section */ +.sidebar-about h1 { + color: #fff; + margin-top: 0; + font-family: "Abril Fatface", serif; + font-size: 3.25rem; +} + +/* Sidebar nav */ +.sidebar-nav { + padding-left: 0; + list-style: none; +} + +.sidebar-nav-item { + display: block; +} + +a.sidebar-nav-item:hover, +a.sidebar-nav-item:focus { + text-decoration: underline; +} + +.sidebar-nav-item.active { + font-weight: bold; +} + +/* Sticky sidebar + * + * Add the `sidebar-sticky` class to the sidebar's container to affix it the + * contents to the bottom of the sidebar in tablets and up. + */ +@media (min-width: 48em) { + .sidebar-sticky { + position: absolute; + right: 1rem; + bottom: 1rem; + left: 1rem; + } + @supports (padding: max(0px)) { + body:not(.layout-reverse) .sidebar-sticky { + padding-left: max(1rem, env(safe-area-inset-left)); + } + .layout-reverse .sidebar-sticky { + padding-right: max(1rem, env(safe-area-inset-right)); + } + } +} +/* Container + * + * Align the contents of the site above the proper threshold with some margin-fu + * with a 25%-wide `.sidebar`. + */ +.content { + padding-top: 4rem; + padding-bottom: 4rem; +} + +@supports (padding: max(0px)) { + body:not(.layout-reverse) .content { + padding-right: max(1rem, env(safe-area-inset-right)); + } + .layout-reverse .content { + padding-left: max(1rem, env(safe-area-inset-left)); + } +} +@media (min-width: 48em) { + .content { + max-width: 38rem; + margin-left: 20rem; + margin-right: 2rem; + } +} +@media (min-width: 64em) { + .content { + margin-left: 22rem; + margin-right: 4rem; + } +} +/* + * Reverse layout + * + * Flip the orientation of the page by placing the `.sidebar` on the right. + */ +@media (min-width: 48em) { + .layout-reverse .sidebar { + left: auto; + right: 0; + } + .layout-reverse .content { + margin-left: 2rem; + margin-right: 20rem; + } +} +@media (min-width: 64em) { + .layout-reverse .content { + margin-left: 4rem; + margin-right: 22rem; + } +} +/* + * Themes + * + * As of v1.1, Hyde includes optional themes to color the sidebar and links + * within blog posts. To use, add the class of your choosing to the `body`. + */ +/* Base16 (http://chriskempson.github.io/base16/#default) */ +/* Red */ +.theme-base-08 .sidebar { + background-color: #ac4142; +} + +.theme-base-08 .content a, +.theme-base-08 .related-posts li a:hover { + color: #ac4142; +} + +/* Orange */ +.theme-base-09 .sidebar { + background-color: #d28445; +} + +.theme-base-09 .content a, +.theme-base-09 .related-posts li a:hover { + color: #d28445; +} + +/* Yellow */ +.theme-base-0a .sidebar { + background-color: #f4bf75; +} + +.theme-base-0a .content a, +.theme-base-0a .related-posts li a:hover { + color: #f4bf75; +} + +/* Green */ +.theme-base-0b .sidebar { + background-color: #90a959; +} + +.theme-base-0b .content a, +.theme-base-0b .related-posts li a:hover { + color: #90a959; +} + +/* Cyan */ +.theme-base-0c .sidebar { + background-color: #75b5aa; +} + +.theme-base-0c .content a, +.theme-base-0c .related-posts li a:hover { + color: #75b5aa; +} + +/* Blue */ +.theme-base-0d .sidebar { + background-color: #6a9fb5; +} + +.theme-base-0d .content a, +.theme-base-0d .related-posts li a:hover { + color: #6a9fb5; +} + +/* Magenta */ +.theme-base-0e .sidebar { + background-color: #aa759f; +} + +.theme-base-0e .content a, +.theme-base-0e .related-posts li a:hover { + color: #aa759f; +} + +/* Brown */ +.theme-base-0f .sidebar { + background-color: #8f5536; +} + +.theme-base-0f .content a, +.theme-base-0f .related-posts li a:hover { + color: #8f5536; +} + +/*# sourceMappingURL=c-hyde.css.map */ diff --git a/docs/assets/c-hyde.css.map b/docs/assets/c-hyde.css.map new file mode 100644 index 0000000..dd72137 --- /dev/null +++ b/docs/assets/c-hyde.css.map @@ -0,0 +1 @@ +{"version":3,"sourceRoot":"","sources":["../../sass/c-hyde.scss"],"names":[],"mappings":"AAAA;AAAA;;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA;AAAA;AAAA;AAAA;AAAA;AAMA;EACE;EACG;EACK;;;AAGV;AAAA;EAEE;EACA;;;AAGF;EACE;EACA;EACA;;;AAEF;EACE;IACE;;;AAIJ;EACE;EACA;EACA;EACI;;;AAGN;AACA;EACE;EACA;;;AAEF;AACA;AAAA;EAEE;;;AAGF;AACA;EACE;EACA;EACA;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;AAGF;AACA;EACE;EACA;;;AAGF;EACE;;;AAIF;AACA;EACE;EACA;;;AAGF;EACE;;;AAEF;EACE;;;AAGF;AACA;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAEF;EACE;EACA;;;AAGF;AACA;AAAA;EAEE;;;AAEF;EACE;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;;;AAGF;AACA;EACE;EACA;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;IACE;IACA;;;AAIJ;EACE;EACA;EACA;EACA;;;AAGF;AACA;EACE;EACA;EACA;EACA;;;AAEF;AAAA;EAEE;EACA;;;AAEF;AAAA;EAEE;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAMA;EACE;EACA;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;EACE;EACA;EACA;EACA;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAMA;EACE;EACA;EACA;EACA;EACA;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAMA;EACE;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;EACA;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;AAAA;EAEE;;;AAGF;AACA;AAAA;AAAA;EAGE;;;AAEF;AAAA;EAEE;;;AAGF;AACA;EACE;EACA;EACA;EACA;;;AAGF;AACA;EACE;EACA;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;;;AAIF;AACA;EACE;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;;;AAIF;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;EACE;EACA;EACA;EACA;EACA;EACA;;;AAGF;AACA;EACE;EACA;EACA;;;AAEF;EACE;;;AAGF;AACA;EACE;;;AAGF;EACE;IACE;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA;;EAEF;IACE;IACA;IACA;;;AAIJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA;AAAA;AAAA;AAAA;AAAA;AAMA;EACE;;;AAEF;EACE;IACE;;;AAGJ;EACE;IACE;;;AAKJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;EACE;EACA;EACA;EACA;;;AAEF;EACE;IACE;IACA;IACA;IACA;IACA;IACA;;;AAIJ;AACA;EACE;;;AAGF;AACA;EACE;EACA;EACA;EACA;;;AAGF;AACA;EACE;EACA;;;AAEF;EACE;;;AAEF;AAAA;EAEE;;;AAEF;EACE;;;AAGF;AAAA;AAAA;AAAA;AAAA;AAMA;EACE;IACE;IACA;IACA;IACA;;EAIF;IACE;MAEI;;IAGJ;MAGI;;;;AAMR;AAAA;AAAA;AAAA;AAAA;AAMA;EACE;EACA;;;AAGF;EACE;IAEI;;EAGJ;IAEI;;;AAKN;EACE;IACE;IACA;IACA;;;AAIJ;EACE;IACE;IACA;;;AAKJ;AAAA;AAAA;AAAA;AAAA;AAMA;EACE;IACE;IACA;;EAEF;IACE;IACA;;;AAIJ;EACE;IACE;IACA;;;AAMJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;AAEA;AACA;EACE;;;AAEF;AAAA;EAEE;;;AAGF;AACA;EACE;;;AAEF;AAAA;EAEE;;;AAGF;AACA;EACE;;;AAEF;AAAA;EAEE;;;AAGF;AACA;EACE;;;AAEF;AAAA;EAEE;;;AAGF;AACA;EACE;;;AAEF;AAAA;EAEE;;;AAGF;AACA;EACE;;;AAEF;AAAA;EAEE;;;AAGF;AACA;EACE;;;AAEF;AAAA;EAEE;;;AAGF;AACA;EACE;;;AAEF;AAAA;EAEE","file":"c-hyde.css"} \ No newline at end of file diff --git a/docs/assets/resume.pdf b/docs/assets/resume.pdf deleted file mode 100644 index 3dbbbda..0000000 Binary files a/docs/assets/resume.pdf and /dev/null differ diff --git a/docs/colophon/index.html b/docs/colophon/index.html new file mode 100644 index 0000000..5c41306 --- /dev/null +++ b/docs/colophon/index.html @@ -0,0 +1,85 @@ + + + + + + + + + Colophon + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+
+ + +
+

Colophon

+ +

This website is generated using a custom static site generator I wrote in Python. The theme is a port of @mdo's Hyde, ported by the makers of Zola.

+ +

All the Open Graph images are generated using Pillow and the Futura font. The math is taken care of by an extra I created for the python-markdown2 library that converts inline and block LATEX into MathML.

+ +

Since this website is currently using the .dev tld, there is no support for HTTP in most browsers (Since they use HSTS preloading). But if you ever find yourself on an IBM PC 5150 and need to use hget, that should work.

+ +
+ +
    + +
+ + +
+ + + + \ No newline at end of file diff --git a/docs/feed.rss b/docs/feed.rss index 4570558..cadea45 100644 --- a/docs/feed.rss +++ b/docs/feed.rss @@ -4,8 +4,8 @@ Navan's Archive Rare Tips, Tricks and Posts https://web.navan.dev/en - Tue, 26 Mar 2024 23:45:22 -0000 - Tue, 26 Mar 2024 23:45:22 -0000 + Wed, 27 Mar 2024 22:48:36 -0000 + Wed, 27 Mar 2024 22:48:36 -0000 250 diff --git a/docs/ideas/2022-12-17-ar-mr-xr.html b/docs/ideas/2022-12-17-ar-mr-xr.html index bade9f1..60df87f 100644 --- a/docs/ideas/2022-12-17-ar-mr-xr.html +++ b/docs/ideas/2022-12-17-ar-mr-xr.html @@ -2,14 +2,26 @@ - + + + + + AR XR MR + + + + + + + - AR XR MR - @@ -29,21 +41,27 @@ - -
-
+ + +
-
- +

AR XR MR

Last Updated: 2022-12-17

@@ -142,14 +160,15 @@

Not every pair of smart glasses need to have AR based surface tracking / SLAM, to display stuff. Just a simple display which can overlay elements on the real world should be capable of displaying tons of data

+
If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
-
+
diff --git a/docs/ideas/index.html b/docs/ideas/index.html index c0a1f20..6932f82 100644 --- a/docs/ideas/index.html +++ b/docs/ideas/index.html @@ -2,14 +2,26 @@ - + + + + + Ideas + + + + + + + - Ideas - @@ -29,18 +41,25 @@ - -
-
+ + +
@@ -70,6 +89,7 @@ +
diff --git a/docs/index.html b/docs/index.html index eb8e161..14eef1f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2,14 +2,26 @@ - + + + + + Home + + + + + + + - Home - @@ -29,25 +41,38 @@ - -
-
+ + +
-

Navan Chauhan

+

Some Projects

+ + -

Recent Posts

+

Recent Posts

+
diff --git a/docs/posts/2010-01-24-experiments.html b/docs/posts/2010-01-24-experiments.html index ba06715..1070a21 100644 --- a/docs/posts/2010-01-24-experiments.html +++ b/docs/posts/2010-01-24-experiments.html @@ -2,14 +2,26 @@ - + + + + + Experiments + + + + + + + - Experiments - @@ -29,35 +41,42 @@ - -
-
- -
+ + +
+ +

Experiments

https://s3-us-west-2.amazonaws.com/s.cdpn.io/148866/img-original.jpg

+
If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
-
+ diff --git a/docs/posts/2019-05-05-Custom-Snowboard-Anemone-Theme.html b/docs/posts/2019-05-05-Custom-Snowboard-Anemone-Theme.html index 4463b37..1c89f5c 100644 --- a/docs/posts/2019-05-05-Custom-Snowboard-Anemone-Theme.html +++ b/docs/posts/2019-05-05-Custom-Snowboard-Anemone-Theme.html @@ -2,14 +2,26 @@ - + + + + + Creating your own custom theme for Snowboard or Anemone + + + + + + + - Creating your own custom theme for Snowboard or Anemone - @@ -29,21 +41,27 @@ - -
-
+ + +
-
- +

Creating your own custom theme for Snowboard or Anemone

Contents

@@ -462,14 +480,15 @@ Section: Themes

You can share this with your friends :+1:

+
If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
-
+
diff --git a/docs/posts/2019-12-04-Google-Teachable-Machines.html b/docs/posts/2019-12-04-Google-Teachable-Machines.html index 878ed30..76d6099 100644 --- a/docs/posts/2019-12-04-Google-Teachable-Machines.html +++ b/docs/posts/2019-12-04-Google-Teachable-Machines.html @@ -2,14 +2,26 @@ - + + + + + Image Classifier With Teachable Machines + + + + + + + - Image Classifier With Teachable Machines - @@ -29,21 +41,27 @@ - -
-
+ + +
-
- +

Image Classifier With Teachable Machines

Made for Google Code-In

@@ -94,14 +112,15 @@

https://luminous-opinion.glitch.me

+
If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
-
+
diff --git a/docs/posts/2019-12-08-Image-Classifier-Tensorflow.html b/docs/posts/2019-12-08-Image-Classifier-Tensorflow.html index b75bdca..7d88d48 100644 --- a/docs/posts/2019-12-08-Image-Classifier-Tensorflow.html +++ b/docs/posts/2019-12-08-Image-Classifier-Tensorflow.html @@ -2,14 +2,26 @@ - + + + + + Creating a Custom Image Classifier using Tensorflow 2.x and Keras for Detecting Malaria + + + + + + + - Creating a Custom Image Classifier using Tensorflow 2.x and Keras for Detecting Malaria - @@ -29,21 +41,27 @@ - -
-
+ + +
-
- +

Creating a Custom Image Classifier using Tensorflow 2.x and Keras for Detecting Malaria

Done during Google Code-In. Org: Tensorflow.

@@ -224,14 +242,15 @@ X_train = X_train/255.0

Link to Colab Notebook

+
If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
-
+
diff --git a/docs/posts/2019-12-08-Splitting-Zips.html b/docs/posts/2019-12-08-Splitting-Zips.html index 1ecb4e6..894e0be 100644 --- a/docs/posts/2019-12-08-Splitting-Zips.html +++ b/docs/posts/2019-12-08-Splitting-Zips.html @@ -2,14 +2,26 @@ - + + + + + Splitting ZIPs into Multiple Parts + + + + + + + - Splitting ZIPs into Multiple Parts - @@ -29,21 +41,27 @@ - -
-
- -
+ + +
+ +

Splitting ZIPs into Multiple Parts

Tested on macOS

@@ -73,14 +91,15 @@
+
If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
-
+ diff --git a/docs/posts/2019-12-10-TensorFlow-Model-Prediction.html b/docs/posts/2019-12-10-TensorFlow-Model-Prediction.html index ecb7680..7624fa7 100644 --- a/docs/posts/2019-12-10-TensorFlow-Model-Prediction.html +++ b/docs/posts/2019-12-10-TensorFlow-Model-Prediction.html @@ -2,14 +2,26 @@ - + + + + + Making Predictions using Image Classifier (TensorFlow) + + + + + + + - Making Predictions using Image Classifier (TensorFlow) - @@ -29,21 +41,27 @@ - -
-
+ + +
-
- +

Making Predictions using Image Classifier (TensorFlow)

This was tested on TF 2.x and works as of 2019-12-10

@@ -104,14 +122,15 @@

Infected

+
If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
-
+
diff --git a/docs/posts/2019-12-16-TensorFlow-Polynomial-Regression.html b/docs/posts/2019-12-16-TensorFlow-Polynomial-Regression.html index 3f3a399..ecb1920 100644 --- a/docs/posts/2019-12-16-TensorFlow-Polynomial-Regression.html +++ b/docs/posts/2019-12-16-TensorFlow-Polynomial-Regression.html @@ -2,14 +2,26 @@ - + + + + + Polynomial Regression Using TensorFlow + + + + + + + - Polynomial Regression Using TensorFlow - @@ -29,21 +41,27 @@ - -
-
+ + +
-
- +

Polynomial Regression Using TensorFlow

In this tutorial you will learn about polynomial regression and how you can implement it in Tensorflow.

@@ -586,14 +604,15 @@ values using the X values. We then plot it to compare the actual data and predic

Basically if you train your machine learning model on a small dataset for a really large number of epochs, the model will learn all the deformities/noise in the data and will actually think that it is a normal part. Therefore when it will see some new data, it will discard that new data as noise and will impact the accuracy of the model in a negative manner

+
If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
-
+
diff --git a/docs/posts/2019-12-22-Fake-News-Detector.html b/docs/posts/2019-12-22-Fake-News-Detector.html index 553831d..8b784e5 100644 --- a/docs/posts/2019-12-22-Fake-News-Detector.html +++ b/docs/posts/2019-12-22-Fake-News-Detector.html @@ -2,14 +2,26 @@ - + + + + + Building a Fake News Detector with Turicreate + + + + + + + - Building a Fake News Detector with Turicreate - @@ -29,21 +41,27 @@ - -
-
+ + +
-
- +

Building a Fake News Detector with Turicreate

In this tutorial we will build a fake news detecting app from scratch, using Turicreate for the machine learning model and SwiftUI for building the app

@@ -308,14 +326,15 @@ DescriptionThe bag-of-words model is a simplifying representation used in NLP, i
+
If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
-
+ diff --git a/docs/posts/2020-01-14-Converting-between-PIL-NumPy.html b/docs/posts/2020-01-14-Converting-between-PIL-NumPy.html index 825f17d..e3c77bb 100644 --- a/docs/posts/2020-01-14-Converting-between-PIL-NumPy.html +++ b/docs/posts/2020-01-14-Converting-between-PIL-NumPy.html @@ -2,14 +2,26 @@ - + + + + + Converting between image and NumPy array + + + + + + + - Converting between image and NumPy array - @@ -29,21 +41,27 @@ - -
-
- -
+ + +
+ +

Converting between image and NumPy array

@@ -70,14 +88,15 @@
+
If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
-
+ diff --git a/docs/posts/2020-01-15-Setting-up-Kaggle-to-use-with-Colab.html b/docs/posts/2020-01-15-Setting-up-Kaggle-to-use-with-Colab.html index 760d44b..7dc3608 100644 --- a/docs/posts/2020-01-15-Setting-up-Kaggle-to-use-with-Colab.html +++ b/docs/posts/2020-01-15-Setting-up-Kaggle-to-use-with-Colab.html @@ -2,14 +2,26 @@ - + + + + + Setting up Kaggle to use with Google Colab + + + + + + + - Setting up Kaggle to use with Google Colab - @@ -29,21 +41,27 @@ - -
-
+ + +
-
- +

Setting up Kaggle to use with Google Colab

In order to be able to access Kaggle Datasets, you will need to have an account on Kaggle (which is Free)

@@ -90,14 +108,15 @@

Voila! You can now download Kaggle datasets

+
If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
-
+
diff --git a/docs/posts/2020-01-16-Image-Classifier-Using-Turicreate.html b/docs/posts/2020-01-16-Image-Classifier-Using-Turicreate.html index f9ed54d..3533db8 100644 --- a/docs/posts/2020-01-16-Image-Classifier-Using-Turicreate.html +++ b/docs/posts/2020-01-16-Image-Classifier-Using-Turicreate.html @@ -2,14 +2,26 @@ - + + + + + Creating a Custom Image Classifier using Turicreate to detect Smoke and Fire + + + + + + + - Creating a Custom Image Classifier using Turicreate to detect Smoke and Fire - @@ -29,21 +41,27 @@ - -
-
+ + +
-
- +

Creating a Custom Image Classifier using Turicreate to detect Smoke and Fire

For setting up Kaggle with Google Colab, please refer to my previous post

@@ -314,14 +332,15 @@

We just got an accuracy of 94% on Training Data and 97% on Validation Data!

+
If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
-
+
diff --git a/docs/posts/2020-01-19-Connect-To-Bluetooth-Devices-Linux-Terminal.html b/docs/posts/2020-01-19-Connect-To-Bluetooth-Devices-Linux-Terminal.html index 4524da8..d4e02a6 100644 --- a/docs/posts/2020-01-19-Connect-To-Bluetooth-Devices-Linux-Terminal.html +++ b/docs/posts/2020-01-19-Connect-To-Bluetooth-Devices-Linux-Terminal.html @@ -2,14 +2,26 @@ - + + + + + How to setup Bluetooth on a Raspberry Pi + + + + + + + - How to setup Bluetooth on a Raspberry Pi - @@ -29,21 +41,27 @@ - -
-
- -
+ + +
+ +

How to setup Bluetooth on a Raspberry Pi

This was tested on a Raspberry Pi Zero W

@@ -66,14 +84,15 @@

To Exit out of bluetoothctl anytime, just type exit

+
If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
-
+ diff --git a/docs/posts/2020-03-03-Playing-With-Android-TV.html b/docs/posts/2020-03-03-Playing-With-Android-TV.html index 923730c..b036d5a 100644 --- a/docs/posts/2020-03-03-Playing-With-Android-TV.html +++ b/docs/posts/2020-03-03-Playing-With-Android-TV.html @@ -2,14 +2,26 @@ - + + + + + Tinkering with an Android TV + + + + + + + - Tinkering with an Android TV - @@ -29,21 +41,27 @@ - -
-
+ + +
-
- +

Tinkering with an Android TV

So I have an Android TV, this posts covers everything I have tried on it

@@ -117,14 +135,15 @@
  • adb uninstall com.company.yourpackagename
  • +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2020-03-08-Making-Vaporwave-Track.html b/docs/posts/2020-03-08-Making-Vaporwave-Track.html index 5b01064..2f6532e 100644 --- a/docs/posts/2020-03-08-Making-Vaporwave-Track.html +++ b/docs/posts/2020-03-08-Making-Vaporwave-Track.html @@ -2,14 +2,26 @@ - + + + + + Making My First Vaporwave Track (Remix) + + + + + + + - Making My First Vaporwave Track (Remix) - @@ -29,21 +41,27 @@ - -
    -
    - -
    + + +
    + +

    Making My First Vaporwave Track (Remix)

    I finally completed my first quick and dirty vaporwave remix of "I Want It That Way" by the Backstreet Boys

    @@ -76,14 +94,15 @@

    The fact that there are steps on producing Vaporwave, this gave me the idea that Vaporwave can actually be made using programming, stay tuned for when I publish the program which I am working on ( Generating A E S T H E T I C artwork and remixes)

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    + diff --git a/docs/posts/2020-04-13-Fixing-X11-Error-AmberTools-macOS.html b/docs/posts/2020-04-13-Fixing-X11-Error-AmberTools-macOS.html index bb6a5f1..ad32b29 100644 --- a/docs/posts/2020-04-13-Fixing-X11-Error-AmberTools-macOS.html +++ b/docs/posts/2020-04-13-Fixing-X11-Error-AmberTools-macOS.html @@ -2,14 +2,26 @@ - + + + + + Fixing X11 Error on macOS Catalina for AmberTools 18/19 + + + + + + + - Fixing X11 Error on macOS Catalina for AmberTools 18/19 - @@ -29,21 +41,27 @@ - -
    -
    - -
    + + +
    + +

    Fixing X11 Error on macOS Catalina for AmberTools 18/19

    I was trying to install AmberTools on my macOS Catalina Installation. Running ./configure -macAccelerate clang gave me an error that it could not find X11 libraries, even though locate libXt showed that my installation was correct.

    @@ -75,14 +93,15 @@ Configure failed due to the errors above!

    If you do not have XQuartz installed, you need to run brew cask install xquartz

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    + diff --git a/docs/posts/2020-05-31-compiling-open-babel-on-ios.html b/docs/posts/2020-05-31-compiling-open-babel-on-ios.html index f9a5cb4..427cc86 100644 --- a/docs/posts/2020-05-31-compiling-open-babel-on-ios.html +++ b/docs/posts/2020-05-31-compiling-open-babel-on-ios.html @@ -2,14 +2,26 @@ - + + + + + Compiling Open Babel on iOS + + + + + + + - Compiling Open Babel on iOS - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Compiling Open Babel on iOS

    Due to the fact that my summer vacations started today, @@ -161,14 +179,15 @@ export BABEL_LIBDIR="/usr/lib/openbabel/3.1.0"

    Edit 1: Added Screenshots, had to replicate the errors.

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2020-06-01-Speeding-Up-Molecular-Docking-Workflow-AutoDock-Vina-and-PyMOL.html b/docs/posts/2020-06-01-Speeding-Up-Molecular-Docking-Workflow-AutoDock-Vina-and-PyMOL.html index 8126a04..b396ad6 100644 --- a/docs/posts/2020-06-01-Speeding-Up-Molecular-Docking-Workflow-AutoDock-Vina-and-PyMOL.html +++ b/docs/posts/2020-06-01-Speeding-Up-Molecular-Docking-Workflow-AutoDock-Vina-and-PyMOL.html @@ -2,14 +2,26 @@ - + + + + + Workflow for Lightning Fast Molecular Docking Part One + + + + + + + - Workflow for Lightning Fast Molecular Docking Part One - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Workflow for Lightning Fast Molecular Docking Part One

    My Setup

    @@ -90,14 +108,15 @@ alias pbpaste='xclip -selection clipboard -o'

    This is just the docking command for AutoDock Vina. In the next part I will tell how to use PyMOL and a plugin to directly generate the coordinates in Vina format --center_x -9.7 --center_y 11.4 --center_z 68.9 --size_x 19.3 --size_y 29.9 --size_z 21.3 without needing to type them manually.

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2020-06-02-Compiling-AutoDock-Vina-on-iOS.html b/docs/posts/2020-06-02-Compiling-AutoDock-Vina-on-iOS.html index 7efd518..c4521f3 100644 --- a/docs/posts/2020-06-02-Compiling-AutoDock-Vina-on-iOS.html +++ b/docs/posts/2020-06-02-Compiling-AutoDock-Vina-on-iOS.html @@ -2,14 +2,26 @@ - + + + + + Compiling AutoDock Vina on iOS + + + + + + + - Compiling AutoDock Vina on iOS - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Compiling AutoDock Vina on iOS

    Why? Because I can.

    @@ -127,14 +145,15 @@ return path(str, boost::filesystem::native);

    The package is available on my repository and only depends on boost. ( Both, Vina and Vina-Split are part of the package)

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2020-07-01-Install-rdkit-colab.html b/docs/posts/2020-07-01-Install-rdkit-colab.html index 6e96c60..aec6741 100644 --- a/docs/posts/2020-07-01-Install-rdkit-colab.html +++ b/docs/posts/2020-07-01-Install-rdkit-colab.html @@ -2,14 +2,26 @@ - + + + + + Installing RDKit on Google Colab + + + + + + + - Installing RDKit on Google Colab - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Installing RDKit on Google Colab

    EDIT: Try installing RDKit using pip

    @@ -150,14 +168,15 @@ logger.info("rdkit-{} installation finished!".format(rdkit.__version__)) install() ```

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2020-08-01-Natural-Feature-Tracking-ARJS.html b/docs/posts/2020-08-01-Natural-Feature-Tracking-ARJS.html index acebee4..cd65be1 100644 --- a/docs/posts/2020-08-01-Natural-Feature-Tracking-ARJS.html +++ b/docs/posts/2020-08-01-Natural-Feature-Tracking-ARJS.html @@ -2,14 +2,26 @@ - + + + + + Introduction to AR.js and Natural Feature Tracking + + + + + + + - Introduction to AR.js and Natural Feature Tracking - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Introduction to AR.js and Natural Feature Tracking

    AR.js

    @@ -329,14 +347,15 @@ Serving HTTP on 0.0.0.0 port 8000 ...

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2020-10-11-macOS-Virtual-Cam-OBS.html b/docs/posts/2020-10-11-macOS-Virtual-Cam-OBS.html index d90cdfc..4d61d9e 100644 --- a/docs/posts/2020-10-11-macOS-Virtual-Cam-OBS.html +++ b/docs/posts/2020-10-11-macOS-Virtual-Cam-OBS.html @@ -2,14 +2,26 @@ - + + + + + Trying Different Camera Setups + + + + + + + - Trying Different Camera Setups - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Trying Different Camera Setups

      @@ -154,14 +172,15 @@ new Dics({ }); +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2020-11-17-Lets-Encrypt-DuckDns.html b/docs/posts/2020-11-17-Lets-Encrypt-DuckDns.html index 270adfa..c78fb06 100644 --- a/docs/posts/2020-11-17-Lets-Encrypt-DuckDns.html +++ b/docs/posts/2020-11-17-Lets-Encrypt-DuckDns.html @@ -2,14 +2,26 @@ - + + + + + Generating HTTPS Certificate using DNS a Challenge through Let's Encrypt + + + + + + + - Generating HTTPS Certificate using DNS a Challenge through Let's Encrypt - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Generating HTTPS Certificate using DNS a Challenge through Let's Encrypt

    I have a Raspberry-Pi running a Flask app through Gunicorn (Ubuntu 20.04 LTS). I am exposing it to the internet using DuckDNS.

    @@ -122,14 +140,15 @@ navanspi.duckdns.org. 60Caveats with copying the certificate: If you renew the certificate you will have to re-copy the files

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2020-12-1-HTML-JS-RSS-Feed.html b/docs/posts/2020-12-1-HTML-JS-RSS-Feed.html index dabde3d..c0262ec 100644 --- a/docs/posts/2020-12-1-HTML-JS-RSS-Feed.html +++ b/docs/posts/2020-12-1-HTML-JS-RSS-Feed.html @@ -2,14 +2,26 @@ - + + + + + RSS Feed written in HTML + JavaScript + + + + + + + - RSS Feed written in HTML + JavaScript - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    RSS Feed written in HTML + JavaScript

    If you want to directly open the HTML file in your browser after saving, don't forget to set CORS_PROXY=""

    @@ -247,14 +265,15 @@
    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    - + diff --git a/docs/posts/2021-06-25-Blog2Twitter-P1.html b/docs/posts/2021-06-25-Blog2Twitter-P1.html index 15d7cd7..26e1596 100644 --- a/docs/posts/2021-06-25-Blog2Twitter-P1.html +++ b/docs/posts/2021-06-25-Blog2Twitter-P1.html @@ -2,14 +2,26 @@ - + + + + + Posting Blog Posts as Twitter Threads Part 1/n + + + + + + + - Posting Blog Posts as Twitter Threads Part 1/n - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Posting Blog Posts as Twitter Threads Part 1/n

    Why? Eh, no good reason, but should be fun.

    @@ -147,14 +165,15 @@ I am not handling lists or images right now.

    For the next part, I will try to append the code as well. I actually added the code to this post after running the program.

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2021-06-25-NFC-Music-Cards-Basic-iOS.html b/docs/posts/2021-06-25-NFC-Music-Cards-Basic-iOS.html index 426e975..492711b 100644 --- a/docs/posts/2021-06-25-NFC-Music-Cards-Basic-iOS.html +++ b/docs/posts/2021-06-25-NFC-Music-Cards-Basic-iOS.html @@ -2,14 +2,26 @@ - + + + + + Basic NFC Music Cards for iOS + + + + + + + - Basic NFC Music Cards for iOS - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Basic NFC Music Cards for iOS

    I had a pack of NFC cards and decided it was the perfect time to create Music Cards. I do not have a "music setup." @@ -73,14 +91,15 @@ So, I did not have to ensure this could work with any device. I settled with usi +

    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2021-06-26-Cheminformatics-On-The-Web-2021.html b/docs/posts/2021-06-26-Cheminformatics-On-The-Web-2021.html index 2947c21..a249433 100644 --- a/docs/posts/2021-06-26-Cheminformatics-On-The-Web-2021.html +++ b/docs/posts/2021-06-26-Cheminformatics-On-The-Web-2021.html @@ -2,14 +2,26 @@ - + + + + + Cheminformatics on the Web (2021) + + + + + + + - Cheminformatics on the Web (2021) - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Cheminformatics on the Web (2021)

    Here, I have compiled a list of some libraries and possible ideas. @@ -126,14 +144,15 @@ Hopefully, this encourages you to explore the world of cheminformatics on the we

    Getting Started with RDKit-JS

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2021-06-27-Crude-ML-AI-Powered-Chatbot-Swift.html b/docs/posts/2021-06-27-Crude-ML-AI-Powered-Chatbot-Swift.html index f4c779f..d6d2ecc 100644 --- a/docs/posts/2021-06-27-Crude-ML-AI-Powered-Chatbot-Swift.html +++ b/docs/posts/2021-06-27-Crude-ML-AI-Powered-Chatbot-Swift.html @@ -2,14 +2,26 @@ - + + + + + Making a Crude ML Powered Chatbot in Swift using CoreML + + + + + + + - Making a Crude ML Powered Chatbot in Swift using CoreML - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Making a Crude ML Powered Chatbot in Swift using CoreML

    A chatbot/virtual assistant, on paper, looks easy to build. @@ -221,14 +239,15 @@ Otherwise, it calls the custom action.

    If I ever release a part-2, it will either be about implementing this in Tensorflow.JS or an iOS app using SwiftUI ;)

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2022-05-21-Similar-Movies-Recommender.html b/docs/posts/2022-05-21-Similar-Movies-Recommender.html index c1c103b..bba6725 100644 --- a/docs/posts/2022-05-21-Similar-Movies-Recommender.html +++ b/docs/posts/2022-05-21-Similar-Movies-Recommender.html @@ -2,14 +2,26 @@ - + + + + + Building a Similar Movies Recommendation System + + + + + + + - Building a Similar Movies Recommendation System - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Building a Similar Movies Recommendation System

    Why?

    @@ -450,14 +468,15 @@ Spies (2015): A secret agent must perform a heist without time on his side
  • Filter based on popularity: The data already exists in the indexed database
  • +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2022-08-05-Why-You-No-Host.html b/docs/posts/2022-08-05-Why-You-No-Host.html index bef89f6..281e21e 100644 --- a/docs/posts/2022-08-05-Why-You-No-Host.html +++ b/docs/posts/2022-08-05-Why-You-No-Host.html @@ -2,14 +2,26 @@ - + + + + + Why You No Host? + + + + + + + - Why You No Host? - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Why You No Host?

    @@ -223,14 +241,15 @@

    Highly context dependent. I run two YunoHost servers in two different locations. One of the ISP has actually blacklisted the residential IP address range and does not let me change my reverseDNS, which means all my outgoing emails are marked as spam. On the other hand, the other ISP gave a clean static IP and the server managed for a small business is not at all problematic for emailing. YMMV but at least you know you have an option.

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2022-11-07-a-new-method-to-blog.html b/docs/posts/2022-11-07-a-new-method-to-blog.html index 7f30c72..9f4ce15 100644 --- a/docs/posts/2022-11-07-a-new-method-to-blog.html +++ b/docs/posts/2022-11-07-a-new-method-to-blog.html @@ -2,14 +2,26 @@ - + + + + + A new method to blog + + + + + + + - A new method to blog - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    A new method to blog

    Here is the original PDF. I made some edits to the content after generating the markdown file

    @@ -78,14 +96,15 @@

    * In Part 2, I will discuss some more features *

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2022-12-25-blog-to-toot.html b/docs/posts/2022-12-25-blog-to-toot.html index fd44801..cb1f9e4 100644 --- a/docs/posts/2022-12-25-blog-to-toot.html +++ b/docs/posts/2022-12-25-blog-to-toot.html @@ -2,14 +2,26 @@ - + + + + + Posting blogs as Mastodon Toots + + + + + + + - Posting blogs as Mastodon Toots - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Posting blogs as Mastodon Toots

    What is better than posting a blog post? Posting about your posting pipeline. I did this previously with Twitter.

    @@ -326,14 +344,15 @@ Seeing that you are reading this on Mastodon, and that I have updated this secti

    Not the best thing I have ever written, but it works!

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2023-02-08-Interact-with-siri-from-the-terminal.html b/docs/posts/2023-02-08-Interact-with-siri-from-the-terminal.html index 29322a1..e31fb80 100644 --- a/docs/posts/2023-02-08-Interact-with-siri-from-the-terminal.html +++ b/docs/posts/2023-02-08-Interact-with-siri-from-the-terminal.html @@ -2,14 +2,26 @@ - + + + + + Interacting with Siri using the command line + + + + + + + - Interacting with Siri using the command line - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Interacting with Siri using the command line

    My main objective was to see if I could issue multi-intent commands in one go. Obviously, Siri cannot do that (neither can Alexa, Cortana, or Google Assistant). The script here can issue either a single command, or use the help of OpenAI's DaVinci model to extract multiple commands and pass them onto siri.

    @@ -275,14 +293,15 @@ python3 main.py &

    Siri is still dumb. When I ask it to Switch off the lights, it default to the home thousands of miles away. But, this code snippet definitely does work!

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2023-03-17-future-of-writing.html b/docs/posts/2023-03-17-future-of-writing.html deleted file mode 100644 index 3fac30a..0000000 --- a/docs/posts/2023-03-17-future-of-writing.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - Future of Writing - - - - - - - - - - - - - - - - - - - - - -
    -
    - -
    - -

    Future of Writing

    - -

    I love taking jotting down my thoughts as bullet points. -I find it easier to be able to recall my thoughts by just reading the keywords. -But, at the same time, am I actually able to recall everything?

    - -

    The primary reason I started writing in my journal is because I knew, I was never -able to recall anything with 100% guarantee.

    - -

    So, the question arises, does it still make sense to put time and effort into writing blog posts? -You can simply ask an autoregressive model to generate it for you, based on bullet points. -I feel like writitng still has a place in this world. Limitting ourselves to a model trained on a finite dataset, feels like an insult to creativity. -If neural networks stopped being prediction machines, and were actually able to "think", I would still believe that creativity wins. -Even if that creativity was now coming from the machine.

    - -
    -

    I am the master of my fate,. I am the captain of my soul.

    -
    - -

    As long as I am alive, and I have the spirit of being rebellious, I am never going to stop trying to write. -Even if we have a tool that can generate the perfect essay, we humans will still write.

    - -

    Why? Just because we can.

    - -
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    - -
    - -
    -
    - - - - - \ No newline at end of file diff --git a/docs/posts/2023-04-30-n-body-simulation.html b/docs/posts/2023-04-30-n-body-simulation.html index 732854e..b244949 100644 --- a/docs/posts/2023-04-30-n-body-simulation.html +++ b/docs/posts/2023-04-30-n-body-simulation.html @@ -2,14 +2,26 @@ - + + + + + n-body solution generator + + + + + + + - n-body solution generator - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    n-body solution generator

    This post requires JavaScript to be viewed properly :(

    @@ -766,14 +784,15 @@ function plotRandomNBodySimulation() {
  • Moore, Cristopher (1993), "Braids in classical dynamics", Physical Review Letters, 70 (24): 3675–3679
  • +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2023-10-04-bomb-lab.html b/docs/posts/2023-10-04-bomb-lab.html index f09fc24..01ae779 100644 --- a/docs/posts/2023-10-04-bomb-lab.html +++ b/docs/posts/2023-10-04-bomb-lab.html @@ -2,14 +2,26 @@ - + + + + + Bomb Lab + + + + + + + - Bomb Lab - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Bomb Lab

    Introduction

    @@ -1136,14 +1154,15 @@ Your instructor has been notified and will verify your solution.

    But, what about the secret phase?

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2023-10-05-attack-lab.html b/docs/posts/2023-10-05-attack-lab.html index f75b8a3..480578c 100644 --- a/docs/posts/2023-10-05-attack-lab.html +++ b/docs/posts/2023-10-05-attack-lab.html @@ -2,14 +2,26 @@ - + + + + + Attack Lab + + + + + + + - Attack Lab - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Attack Lab

    Introduction

    @@ -504,14 +522,15 @@ NICE JOB!
    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    - + diff --git a/docs/posts/2023-10-22-search-by-flair-reddit.html b/docs/posts/2023-10-22-search-by-flair-reddit.html index c81a48b..9fd9ee5 100644 --- a/docs/posts/2023-10-22-search-by-flair-reddit.html +++ b/docs/posts/2023-10-22-search-by-flair-reddit.html @@ -2,14 +2,26 @@ - + + + + + Search / Filter posts by flair on Reddit + + + + + + + - Search / Filter posts by flair on Reddit - @@ -29,21 +41,27 @@ - -
    -
    - -
    + + +
    + +

    Search / Filter posts by flair on Reddit

    Remember to replace any spaces in the flair with _

    @@ -54,14 +72,15 @@

    I wish this was documented somewhere.

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    + diff --git a/docs/posts/2024-01-05-hello-20224.html b/docs/posts/2024-01-05-hello-20224.html index 4c58b4c..32e2a93 100644 --- a/docs/posts/2024-01-05-hello-20224.html +++ b/docs/posts/2024-01-05-hello-20224.html @@ -2,14 +2,26 @@ - + + + + + Hello 2024 + + + + + + + - Hello 2024 - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Hello 2024

    2024 % 4 == 0

    @@ -104,14 +122,15 @@
  • Do a deeper dive into the math of Machine/Deep Learning, before I get back into it
  • +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2024-02-26-control-element-under-another-element-html-css.html b/docs/posts/2024-02-26-control-element-under-another-element-html-css.html index 6c44808..3509983 100644 --- a/docs/posts/2024-02-26-control-element-under-another-element-html-css.html +++ b/docs/posts/2024-02-26-control-element-under-another-element-html-css.html @@ -2,14 +2,26 @@ - + + + + + Interacting with underlying element in HTML + + + + + + + - Interacting with underlying element in HTML - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Interacting with underlying element in HTML

    I know that the title is a bit weird. I was trying to interact with a video under an iPhone Bezel Screen frame.

    @@ -117,14 +135,15 @@ A box with 200px height and 300px width

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    - + diff --git a/docs/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.html b/docs/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.html index 7fcece6..502d4c9 100644 --- a/docs/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.html +++ b/docs/posts/2024-03-15-setting-up-macos-for-8088-dos-dev.html @@ -2,14 +2,26 @@ - + + + + + Cross-Compiling Hello World for DOS on macOS + + + + + + + - Cross-Compiling Hello World for DOS on macOS - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Cross-Compiling Hello World for DOS on macOS

    Technically this should work for any platform that OpenWatcom 2 supports compiling binaries for. Some instructions are based on a post at retrocoding.net, @@ -316,14 +334,15 @@ creating a DOS My DOSBox setup might look slightly different than yours...

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.html b/docs/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.html index e2edc19..6dcd62b 100644 --- a/docs/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.html +++ b/docs/posts/2024-03-21-Polynomial-Regression-in-TensorFlow-2.html @@ -2,14 +2,26 @@ - + + + + + Polynomial Regression Using TensorFlow 2.x + + + + + + + - Polynomial Regression Using TensorFlow 2.x - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Polynomial Regression Using TensorFlow 2.x

    I have a similar post titled Polynomial Regression Using Tensorflow that used tensorflow.compat.v1 (Which still works as of TF 2.16). But, I thought it would be nicer to redo it with newer TF versions.

    @@ -283,14 +301,15 @@
    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    - + diff --git a/docs/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.html b/docs/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.html index 39bfe88..bb2bc8e 100644 --- a/docs/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.html +++ b/docs/posts/2024-03-26-Derivation-of-the-Quadratic-Equation.html @@ -2,14 +2,26 @@ - + + + + + Quadratic Formula Derivation + + + + + + + - Quadratic Formula Derivation - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Quadratic Formula Derivation

    The standard form of a quadratic equation is:

    @@ -76,14 +94,15 @@ x=b±b24ac2a +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    +
    diff --git a/docs/posts/hello-world.html b/docs/posts/hello-world.html index bd429ce..a830838 100644 --- a/docs/posts/hello-world.html +++ b/docs/posts/hello-world.html @@ -2,14 +2,26 @@ - + + + + + Hello World + + + + + + + - Hello World - @@ -29,35 +41,42 @@ - -
    -
    - -
    + + +
    + +

    Hello World

    Why a Hello World post?

    Just re-did the entire website using Publish (Publish by John Sundell). So, a new hello world post :)

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    + diff --git a/docs/posts/index.html b/docs/posts/index.html index 2ffd8b9..63e4251 100644 --- a/docs/posts/index.html +++ b/docs/posts/index.html @@ -2,14 +2,26 @@ - + + + + + Posts + + + + + + + - Posts - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -683,6 +702,7 @@ +
    diff --git a/docs/publications/2019-05-14-Detecting-Driver-Fatigue-Over-Speeding-and-Speeding-up-Post-Accident-Response.html b/docs/publications/2019-05-14-Detecting-Driver-Fatigue-Over-Speeding-and-Speeding-up-Post-Accident-Response.html index 5da0ca3..4971c30 100644 --- a/docs/publications/2019-05-14-Detecting-Driver-Fatigue-Over-Speeding-and-Speeding-up-Post-Accident-Response.html +++ b/docs/publications/2019-05-14-Detecting-Driver-Fatigue-Over-Speeding-and-Speeding-up-Post-Accident-Response.html @@ -2,14 +2,26 @@ - + + + + + Detecting Driver Fatigue, Over-Speeding, and Speeding up Post-Accident Response + + + + + + + - Detecting Driver Fatigue, Over-Speeding, and Speeding up Post-Accident Response - @@ -29,21 +41,27 @@ - -
    -
    - -
    + + +
    + +

    Detecting Driver Fatigue, Over-Speeding, and Speeding up Post-Accident Response

    @@ -66,14 +84,15 @@
    @article{chauhan_2019, title={Detecting Driver Fatigue, Over-Speeding, and Speeding up Post-Accident Response}, volume={6}, url={https://www.irjet.net/archives/V6/i5/IRJET-V6I5318.pdf}, number={5}, journal={International Research Journal of Engineering and Technology (IRJET)}, author={Chauhan, Navan}, year={2019}}
     
    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    + diff --git a/docs/publications/2020-03-14-generating-vaporwave.html b/docs/publications/2020-03-14-generating-vaporwave.html index cbebbbf..5796cd7 100644 --- a/docs/publications/2020-03-14-generating-vaporwave.html +++ b/docs/publications/2020-03-14-generating-vaporwave.html @@ -2,14 +2,26 @@ - + + + + + Is it possible to programmatically generate Vaporwave? + + + + + + + - Is it possible to programmatically generate Vaporwave? - @@ -29,21 +41,27 @@ - -
    -
    - -
    + + +
    + +

    Is it possible to programmatically generate Vaporwave?

    This is still a pre-print.

    @@ -80,14 +98,15 @@ } +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    + diff --git a/docs/publications/2020-03-17-Possible-Drug-Candidates-COVID-19.html b/docs/publications/2020-03-17-Possible-Drug-Candidates-COVID-19.html index f990ce6..cd7a590 100644 --- a/docs/publications/2020-03-17-Possible-Drug-Candidates-COVID-19.html +++ b/docs/publications/2020-03-17-Possible-Drug-Candidates-COVID-19.html @@ -2,14 +2,26 @@ - + + + + + Possible Drug Candidates for COVID-19 + + + + + + + - Possible Drug Candidates for COVID-19 - @@ -29,35 +41,42 @@ - -
    -
    - -
    + + +
    + +

    Possible Drug Candidates for COVID-19

    This is still a pre-print.

    Download paper here

    +
    If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
    -
    + diff --git a/docs/publications/index.html b/docs/publications/index.html index 8bce2c4..70db8c3 100644 --- a/docs/publications/index.html +++ b/docs/publications/index.html @@ -2,14 +2,26 @@ - + + + + + Publications + + + + + + + - Publications - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -92,6 +111,7 @@ +
    diff --git a/docs/tags/AR.html b/docs/tags/AR.html index 8578cdb..760c118 100644 --- a/docs/tags/AR.html +++ b/docs/tags/AR.html @@ -2,14 +2,26 @@ - + + + + + "AR" + + + + + + + - "AR" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    diff --git a/docs/tags/AR.js.html b/docs/tags/AR.js.html index 9b8c611..e3f9f80 100644 --- a/docs/tags/AR.js.html +++ b/docs/tags/AR.js.html @@ -2,14 +2,26 @@ - + + + + + "AR.js" + + + + + + + - "AR.js" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -69,6 +88,7 @@ +
    diff --git a/docs/tags/Android-TV.html b/docs/tags/Android-TV.html index dcd41fb..06dfec1 100644 --- a/docs/tags/Android-TV.html +++ b/docs/tags/Android-TV.html @@ -2,14 +2,26 @@ - + + + + + "Android-TV" + + + + + + + - "Android-TV" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -65,6 +84,7 @@ +
    diff --git a/docs/tags/Android.html b/docs/tags/Android.html index 285a944..4204bf7 100644 --- a/docs/tags/Android.html +++ b/docs/tags/Android.html @@ -2,14 +2,26 @@ - + + + + + "Android" + + + + + + + - "Android" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -65,6 +84,7 @@ +
    diff --git a/docs/tags/Anemone.html b/docs/tags/Anemone.html index 88ac4b3..2fa65f9 100644 --- a/docs/tags/Anemone.html +++ b/docs/tags/Anemone.html @@ -2,14 +2,26 @@ - + + + + + "Anemone" + + + + + + + - "Anemone" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -71,6 +90,7 @@ +
    diff --git a/docs/tags/AppleScript.html b/docs/tags/AppleScript.html index d9db023..5d1519f 100644 --- a/docs/tags/AppleScript.html +++ b/docs/tags/AppleScript.html @@ -2,14 +2,26 @@ - + + + + + "AppleScript" + + + + + + + - "AppleScript" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -73,6 +92,7 @@ +
    diff --git a/docs/tags/Augmented-Reality.html b/docs/tags/Augmented-Reality.html index 0028d0e..9703856 100644 --- a/docs/tags/Augmented-Reality.html +++ b/docs/tags/Augmented-Reality.html @@ -2,14 +2,26 @@ - + + + + + "Augmented-Reality" + + + + + + + - "Augmented-Reality" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -69,6 +88,7 @@ +
    diff --git a/docs/tags/AutoDock Vina.html b/docs/tags/AutoDock Vina.html index 96b0ba0..2e3a14f 100644 --- a/docs/tags/AutoDock Vina.html +++ b/docs/tags/AutoDock Vina.html @@ -2,14 +2,26 @@ - + + + + + "AutoDock Vina" + + + + + + + - "AutoDock Vina" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -90,6 +109,7 @@ +
    diff --git a/docs/tags/CSS.html b/docs/tags/CSS.html index b11c63d..da94c36 100644 --- a/docs/tags/CSS.html +++ b/docs/tags/CSS.html @@ -2,14 +2,26 @@ - + + + + + "CSS" + + + + + + + - "CSS" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -65,6 +84,7 @@ +
    diff --git a/docs/tags/Cheminformatics.html b/docs/tags/Cheminformatics.html index f9b8a56..3044063 100644 --- a/docs/tags/Cheminformatics.html +++ b/docs/tags/Cheminformatics.html @@ -2,14 +2,26 @@ - + + + + + "Cheminformatics" + + + + + + + - "Cheminformatics" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -120,6 +139,7 @@ +
    diff --git a/docs/tags/Code-Snippet.html b/docs/tags/Code-Snippet.html index 28aecdc..3e793cc 100644 --- a/docs/tags/Code-Snippet.html +++ b/docs/tags/Code-Snippet.html @@ -2,14 +2,26 @@ - + + + + + "Code-Snippet" + + + + + + + - "Code-Snippet" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -197,6 +216,7 @@ +
    diff --git a/docs/tags/Colab.html b/docs/tags/Colab.html index fd8ef08..0c0ac8c 100644 --- a/docs/tags/Colab.html +++ b/docs/tags/Colab.html @@ -2,14 +2,26 @@ - + + + + + "Colab" + + + + + + + - "Colab" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -161,6 +180,7 @@ +
    diff --git a/docs/tags/CoreML.html b/docs/tags/CoreML.html index 0449e64..459de16 100644 --- a/docs/tags/CoreML.html +++ b/docs/tags/CoreML.html @@ -2,14 +2,26 @@ - + + + + + "CoreML" + + + + + + + - "CoreML" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    diff --git a/docs/tags/DOS.html b/docs/tags/DOS.html index 3a75f5b..57181c3 100644 --- a/docs/tags/DOS.html +++ b/docs/tags/DOS.html @@ -2,14 +2,26 @@ - + + + + + "DOS" + + + + + + + - "DOS" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    diff --git a/docs/tags/Designing.html b/docs/tags/Designing.html index 16ac8c0..4c8be70 100644 --- a/docs/tags/Designing.html +++ b/docs/tags/Designing.html @@ -2,14 +2,26 @@ - + + + + + "Designing" + + + + + + + - "Designing" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -71,6 +90,7 @@ +
    diff --git a/docs/tags/Eh.html b/docs/tags/Eh.html index a40a3f6..53ae31d 100644 --- a/docs/tags/Eh.html +++ b/docs/tags/Eh.html @@ -2,14 +2,26 @@ - + + + + + "Eh" + + + + + + + - "Eh" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    diff --git a/docs/tags/Experiment.html b/docs/tags/Experiment.html index 3d7f32f..0cac839 100644 --- a/docs/tags/Experiment.html +++ b/docs/tags/Experiment.html @@ -2,14 +2,26 @@ - + + + + + "Experiment" + + + + + + + - "Experiment" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -63,6 +82,7 @@ +
    diff --git a/docs/tags/Fun.html b/docs/tags/Fun.html index 85d5b46..664873b 100644 --- a/docs/tags/Fun.html +++ b/docs/tags/Fun.html @@ -2,14 +2,26 @@ - + + + + + "Fun" + + + + + + + - "Fun" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    diff --git a/docs/tags/General.html b/docs/tags/General.html index 89ffbd5..1fde199 100644 --- a/docs/tags/General.html +++ b/docs/tags/General.html @@ -2,14 +2,26 @@ - + + + + + "General" + + + + + + + - "General" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -65,6 +84,7 @@ +
    diff --git a/docs/tags/HTML.html b/docs/tags/HTML.html index 411407f..46fc998 100644 --- a/docs/tags/HTML.html +++ b/docs/tags/HTML.html @@ -2,14 +2,26 @@ - + + + + + "HTML" + + + + + + + - "HTML" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -82,6 +101,7 @@ +
    diff --git a/docs/tags/JS.html b/docs/tags/JS.html deleted file mode 100644 index b01594b..0000000 --- a/docs/tags/JS.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - "JS" - - - - - - - - - - - - - - - - - - - - - -
    -
    - - -
    -

    JS

    Posts tagged 'JS'

    -
    - - - - - - - - \ No newline at end of file diff --git a/docs/tags/Jailbreak.html b/docs/tags/Jailbreak.html index 14fea6e..500ff0c 100644 --- a/docs/tags/Jailbreak.html +++ b/docs/tags/Jailbreak.html @@ -2,14 +2,26 @@ - + + + + + "Jailbreak" + + + + + + + - "Jailbreak" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -107,6 +126,7 @@ +
    diff --git a/docs/tags/JavaScript.html b/docs/tags/JavaScript.html index 17ba665..9c90b1d 100644 --- a/docs/tags/JavaScript.html +++ b/docs/tags/JavaScript.html @@ -2,14 +2,26 @@ - + + + + + "JavaScript" + + + + + + + - "JavaScript" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -99,6 +118,7 @@ +
    diff --git a/docs/tags/Just Beer Things.html b/docs/tags/Just Beer Things.html deleted file mode 100644 index 47da614..0000000 --- a/docs/tags/Just Beer Things.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - "Just Beer Things" - - - - - - - - - - - - - - - - - - - - - -
    -
    - - -
    -

    Just Beer Things

    Posts tagged 'Just Beer Things'

    -
    - - - - - - - - \ No newline at end of file diff --git a/docs/tags/Kaggle.html b/docs/tags/Kaggle.html index 14218fc..a6eb348 100644 --- a/docs/tags/Kaggle.html +++ b/docs/tags/Kaggle.html @@ -2,14 +2,26 @@ - + + + + + "Kaggle" + + + + + + + - "Kaggle" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -69,6 +88,7 @@ +
    diff --git a/docs/tags/Linux.html b/docs/tags/Linux.html index 4440512..0673de9 100644 --- a/docs/tags/Linux.html +++ b/docs/tags/Linux.html @@ -2,14 +2,26 @@ - + + + + + "Linux" + + + + + + + - "Linux" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -69,6 +88,7 @@ +
    diff --git a/docs/tags/MR.html b/docs/tags/MR.html index 6461f25..5887f78 100644 --- a/docs/tags/MR.html +++ b/docs/tags/MR.html @@ -2,14 +2,26 @@ - + + + + + "MR" + + + + + + + - "MR" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    diff --git a/docs/tags/Mastodon.html b/docs/tags/Mastodon.html index 60bbaa9..c0e5261 100644 --- a/docs/tags/Mastodon.html +++ b/docs/tags/Mastodon.html @@ -2,14 +2,26 @@ - + + + + + "Mastodon" + + + + + + + - "Mastodon" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -65,6 +84,7 @@ +
    diff --git a/docs/tags/Microsoft Azure.html b/docs/tags/Microsoft Azure.html index 2133a66..03b01b5 100644 --- a/docs/tags/Microsoft Azure.html +++ b/docs/tags/Microsoft Azure.html @@ -2,14 +2,26 @@ - + + + + + "Microsoft Azure" + + + + + + + - "Microsoft Azure" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    diff --git a/docs/tags/Molecular-Docking.html b/docs/tags/Molecular-Docking.html index fd9a89f..079dbcb 100644 --- a/docs/tags/Molecular-Docking.html +++ b/docs/tags/Molecular-Docking.html @@ -2,14 +2,26 @@ - + + + + + "Molecular-Docking" + + + + + + + - "Molecular-Docking" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -90,6 +109,7 @@ +
    diff --git a/docs/tags/Molecular-Dynamics.html b/docs/tags/Molecular-Dynamics.html index 628fdd8..61e6cf4 100644 --- a/docs/tags/Molecular-Dynamics.html +++ b/docs/tags/Molecular-Dynamics.html @@ -2,14 +2,26 @@ - + + + + + "Molecular-Dynamics" + + + + + + + - "Molecular-Dynamics" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -65,6 +84,7 @@ +
    diff --git a/docs/tags/Mountain Biking.html b/docs/tags/Mountain Biking.html index 3be62eb..9af513b 100644 --- a/docs/tags/Mountain Biking.html +++ b/docs/tags/Mountain Biking.html @@ -2,14 +2,26 @@ - + + + + + "Mountain Biking" + + + + + + + - "Mountain Biking" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -65,6 +84,7 @@ +
    diff --git a/docs/tags/Music.html b/docs/tags/Music.html index 626d4c1..424f73c 100644 --- a/docs/tags/Music.html +++ b/docs/tags/Music.html @@ -2,14 +2,26 @@ - + + + + + "Music" + + + + + + + - "Music" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -65,6 +84,7 @@ +
    diff --git a/docs/tags/NLP.html b/docs/tags/NLP.html index 62be2df..cffc3ec 100644 --- a/docs/tags/NLP.html +++ b/docs/tags/NLP.html @@ -2,14 +2,26 @@ - + + + + + "NLP" + + + + + + + - "NLP" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    diff --git a/docs/tags/OCR.html b/docs/tags/OCR.html index da45ccf..7f805b9 100644 --- a/docs/tags/OCR.html +++ b/docs/tags/OCR.html @@ -2,14 +2,26 @@ - + + + + + "OCR" + + + + + + + - "OCR" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    diff --git a/docs/tags/Open-Babel.html b/docs/tags/Open-Babel.html index 81fb947..dfaa9e6 100644 --- a/docs/tags/Open-Babel.html +++ b/docs/tags/Open-Babel.html @@ -2,14 +2,26 @@ - + + + + + "Open-Babel" + + + + + + + - "Open-Babel" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -88,6 +107,7 @@ +
    diff --git a/docs/tags/OpenCV.html b/docs/tags/OpenCV.html deleted file mode 100644 index ddaa485..0000000 --- a/docs/tags/OpenCV.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - "OpenCV" - - - - - - - - - - - - - - - - - - - - - -
    -
    - - -
    -

    OpenCV

    Posts tagged 'OpenCV'

    -
    - - - - - - - - \ No newline at end of file diff --git a/docs/tags/OpenSCAD.html b/docs/tags/OpenSCAD.html index 3101b9b..42d351a 100644 --- a/docs/tags/OpenSCAD.html +++ b/docs/tags/OpenSCAD.html @@ -2,14 +2,26 @@ - + + + + + "OpenSCAD" + + + + + + + - "OpenSCAD" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -65,6 +84,7 @@ +
    diff --git a/docs/tags/Python.html b/docs/tags/Python.html index 84cacff..0919ce6 100644 --- a/docs/tags/Python.html +++ b/docs/tags/Python.html @@ -2,14 +2,26 @@ - + + + + + "Python" + + + + + + + - "Python" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -131,6 +150,7 @@ +
    diff --git a/docs/tags/Raspberry-Pi.html b/docs/tags/Raspberry-Pi.html index e4540e1..59b2304 100644 --- a/docs/tags/Raspberry-Pi.html +++ b/docs/tags/Raspberry-Pi.html @@ -2,14 +2,26 @@ - + + + + + "Raspberry-Pi" + + + + + + + - "Raspberry-Pi" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -69,6 +88,7 @@ +
    diff --git a/docs/tags/Recommendation-System.html b/docs/tags/Recommendation-System.html index 3790886..4a02302 100644 --- a/docs/tags/Recommendation-System.html +++ b/docs/tags/Recommendation-System.html @@ -2,14 +2,26 @@ - + + + + + "Recommendation-System" + + + + + + + - "Recommendation-System" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    diff --git a/docs/tags/Reddit.html b/docs/tags/Reddit.html index b144c53..bc63339 100644 --- a/docs/tags/Reddit.html +++ b/docs/tags/Reddit.html @@ -2,14 +2,26 @@ - + + + + + "Reddit" + + + + + + + - "Reddit" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -65,6 +84,7 @@ +
    diff --git a/docs/tags/Review.html b/docs/tags/Review.html index 5c3543f..457ef19 100644 --- a/docs/tags/Review.html +++ b/docs/tags/Review.html @@ -2,14 +2,26 @@ - + + + + + "Review" + + + + + + + - "Review" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    diff --git a/docs/tags/Self-Hosted.html b/docs/tags/Self-Hosted.html index 251ef2c..d1cb354 100644 --- a/docs/tags/Self-Hosted.html +++ b/docs/tags/Self-Hosted.html @@ -2,14 +2,26 @@ - + + + + + "Self-Hosted" + + + + + + + - "Self-Hosted" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -65,6 +84,7 @@ +
    diff --git a/docs/tags/Shortcuts.html b/docs/tags/Shortcuts.html index 624af57..42d779c 100644 --- a/docs/tags/Shortcuts.html +++ b/docs/tags/Shortcuts.html @@ -2,14 +2,26 @@ - + + + + + "Shortcuts" + + + + + + + - "Shortcuts" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    diff --git a/docs/tags/Siri.html b/docs/tags/Siri.html index 5603a7f..53c60ea 100644 --- a/docs/tags/Siri.html +++ b/docs/tags/Siri.html @@ -2,14 +2,26 @@ - + + + + + "Siri" + + + + + + + - "Siri" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -73,6 +92,7 @@ +
    diff --git a/docs/tags/Snowboard.html b/docs/tags/Snowboard.html index a9af46a..04ea210 100644 --- a/docs/tags/Snowboard.html +++ b/docs/tags/Snowboard.html @@ -2,14 +2,26 @@ - + + + + + "Snowboard" + + + + + + + - "Snowboard" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -71,6 +90,7 @@ +
    diff --git a/docs/tags/Swift.html b/docs/tags/Swift.html index f34aa6d..6748cb3 100644 --- a/docs/tags/Swift.html +++ b/docs/tags/Swift.html @@ -2,14 +2,26 @@ - + + + + + "Swift" + + + + + + + - "Swift" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    diff --git a/docs/tags/SwiftUI.html b/docs/tags/SwiftUI.html index fe5adea..993a672 100644 --- a/docs/tags/SwiftUI.html +++ b/docs/tags/SwiftUI.html @@ -2,14 +2,26 @@ - + + + + + "SwiftUI" + + + + + + + - "SwiftUI" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -69,6 +88,7 @@ +
    diff --git a/docs/tags/Tech Tip.html b/docs/tags/Tech Tip.html index 5b6c51f..6d0f6d8 100644 --- a/docs/tags/Tech Tip.html +++ b/docs/tags/Tech Tip.html @@ -2,14 +2,26 @@ - + + + + + "Tech Tip" + + + + + + + - "Tech Tip" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -65,6 +84,7 @@ +
    diff --git a/docs/tags/Tensorflow.html b/docs/tags/Tensorflow.html index 04006bb..63f2748 100644 --- a/docs/tags/Tensorflow.html +++ b/docs/tags/Tensorflow.html @@ -2,14 +2,26 @@ - + + + + + "Tensorflow" + + + + + + + - "Tensorflow" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -112,6 +131,7 @@ +
    diff --git a/docs/tags/Transformers.html b/docs/tags/Transformers.html index 5a3c929..5928f72 100644 --- a/docs/tags/Transformers.html +++ b/docs/tags/Transformers.html @@ -2,14 +2,26 @@ - + + + + + "Transformers" + + + + + + + - "Transformers" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    diff --git a/docs/tags/Turicreate.html b/docs/tags/Turicreate.html index 37bb660..f742233 100644 --- a/docs/tags/Turicreate.html +++ b/docs/tags/Turicreate.html @@ -2,14 +2,26 @@ - + + + + + "Turicreate" + + + + + + + - "Turicreate" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -101,6 +120,7 @@ +
    diff --git a/docs/tags/Tutorial.html b/docs/tags/Tutorial.html index 9f32bdb..4217261 100644 --- a/docs/tags/Tutorial.html +++ b/docs/tags/Tutorial.html @@ -2,14 +2,26 @@ - + + + + + "tutorial" + + + + + + + - "tutorial" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -69,6 +88,7 @@ +
    diff --git a/docs/tags/Twitter.html b/docs/tags/Twitter.html index 7775b38..4f4e36c 100644 --- a/docs/tags/Twitter.html +++ b/docs/tags/Twitter.html @@ -2,14 +2,26 @@ - + + + + + "Twitter" + + + + + + + - "Twitter" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    diff --git a/docs/tags/Vaporwave.html b/docs/tags/Vaporwave.html index 36a8b01..398eafc 100644 --- a/docs/tags/Vaporwave.html +++ b/docs/tags/Vaporwave.html @@ -2,14 +2,26 @@ - + + + + + "Vaporwave" + + + + + + + - "Vaporwave" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -65,6 +84,7 @@ +
    diff --git a/docs/tags/Web-Development.html b/docs/tags/Web-Development.html index 7dd4e89..63c3472 100644 --- a/docs/tags/Web-Development.html +++ b/docs/tags/Web-Development.html @@ -2,14 +2,26 @@ - + + + + + "Web-Development" + + + + + + + - "Web-Development" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    diff --git a/docs/tags/Webcam.html b/docs/tags/Webcam.html index f4a713f..58ccf90 100644 --- a/docs/tags/Webcam.html +++ b/docs/tags/Webcam.html @@ -2,14 +2,26 @@ - + + + + + "Webcam" + + + + + + + - "Webcam" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    diff --git a/docs/tags/XR.html b/docs/tags/XR.html index a0c53d0..4d05a0f 100644 --- a/docs/tags/XR.html +++ b/docs/tags/XR.html @@ -2,14 +2,26 @@ - + + + + + "XR" + + + + + + + - "XR" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    diff --git a/docs/tags/YunoHost.html b/docs/tags/YunoHost.html index 7f09812..afdbb67 100644 --- a/docs/tags/YunoHost.html +++ b/docs/tags/YunoHost.html @@ -2,14 +2,26 @@ - + + + + + "YunoHost" + + + + + + + - "YunoHost" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -65,6 +84,7 @@ +
    diff --git a/docs/tags/assembly.html b/docs/tags/assembly.html index cfde58f..06da63b 100644 --- a/docs/tags/assembly.html +++ b/docs/tags/assembly.html @@ -2,14 +2,26 @@ - + + + + + "Assembly" + + + + + + + - "Assembly" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -90,6 +109,7 @@ +
    diff --git a/docs/tags/astrophysics.html b/docs/tags/astrophysics.html index 4f7dd90..cec0ea1 100644 --- a/docs/tags/astrophysics.html +++ b/docs/tags/astrophysics.html @@ -2,14 +2,26 @@ - + + + + + "astrophysics" + + + + + + + - "astrophysics" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -65,6 +84,7 @@ +
    diff --git a/docs/tags/c++.html b/docs/tags/c++.html index 1526078..4d4daa1 100644 --- a/docs/tags/c++.html +++ b/docs/tags/c++.html @@ -2,14 +2,26 @@ - + + + + + "C++" + + + + + + + - "C++" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -90,6 +109,7 @@ +
    diff --git a/docs/tags/csci2400.html b/docs/tags/csci2400.html index efa2167..029b7d8 100644 --- a/docs/tags/csci2400.html +++ b/docs/tags/csci2400.html @@ -2,14 +2,26 @@ - + + + + + "CSCI2400" + + + + + + + - "CSCI2400" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -90,6 +109,7 @@ +
    diff --git a/docs/tags/gdb.html b/docs/tags/gdb.html index 944e46b..c0dd3be 100644 --- a/docs/tags/gdb.html +++ b/docs/tags/gdb.html @@ -2,14 +2,26 @@ - + + + + + "gdb" + + + + + + + - "gdb" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -90,6 +109,7 @@ +
    diff --git a/docs/tags/hello-world.html b/docs/tags/hello-world.html index fc420fe..c2d00d6 100644 --- a/docs/tags/hello-world.html +++ b/docs/tags/hello-world.html @@ -2,14 +2,26 @@ - + + + + + "hello-world" + + + + + + + - "hello-world" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -63,6 +82,7 @@ +
    diff --git a/docs/tags/iOS.html b/docs/tags/iOS.html index 3561009..8b47920 100644 --- a/docs/tags/iOS.html +++ b/docs/tags/iOS.html @@ -2,14 +2,26 @@ - + + + + + "iOS" + + + + + + + - "iOS" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -103,6 +122,7 @@ +
    diff --git a/docs/tags/macOS.html b/docs/tags/macOS.html index 028aef3..a963816 100644 --- a/docs/tags/macOS.html +++ b/docs/tags/macOS.html @@ -2,14 +2,26 @@ - + + + + + "macOS" + + + + + + + - "macOS" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -101,6 +120,7 @@ +
    diff --git a/docs/tags/mathematics.html b/docs/tags/mathematics.html index eb5201c..0ccdd79 100644 --- a/docs/tags/mathematics.html +++ b/docs/tags/mathematics.html @@ -2,14 +2,26 @@ - + + + + + "mathematics" + + + + + + + - "mathematics" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -76,6 +95,7 @@ +
    diff --git a/docs/tags/pre-print.html b/docs/tags/pre-print.html index 10e6d7c..7fccfca 100644 --- a/docs/tags/pre-print.html +++ b/docs/tags/pre-print.html @@ -2,14 +2,26 @@ - + + + + + "pre-print" + + + + + + + - "pre-print" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -78,6 +97,7 @@ +
    diff --git a/docs/tags/publication.html b/docs/tags/publication.html index 80b5379..18adc64 100644 --- a/docs/tags/publication.html +++ b/docs/tags/publication.html @@ -2,14 +2,26 @@ - + + + + + "publication" + + + + + + + - "publication" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -89,6 +108,7 @@ +
    diff --git a/docs/tags/ramblings.html b/docs/tags/ramblings.html index f2268fa..3c02403 100644 --- a/docs/tags/ramblings.html +++ b/docs/tags/ramblings.html @@ -2,14 +2,26 @@ - + + + + + "Ramblings" + + + + + + + - "Ramblings" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -65,6 +84,7 @@ +
    diff --git a/docs/tags/reverse-engineering.html b/docs/tags/reverse-engineering.html index d24cd5d..8187cc7 100644 --- a/docs/tags/reverse-engineering.html +++ b/docs/tags/reverse-engineering.html @@ -2,14 +2,26 @@ - + + + + + "Reverse-Engineering" + + + + + + + - "Reverse-Engineering" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -90,6 +109,7 @@ +
    diff --git a/docs/tags/writing.html b/docs/tags/writing.html deleted file mode 100644 index 7f30db8..0000000 --- a/docs/tags/writing.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - "writing" - - - - - - - - - - - - - - - - - - - - - -
    -
    - - -
    -

    writing

    Posts tagged 'writing'

    -
    - - - - - - - - \ No newline at end of file diff --git a/docs/tags/x86.html b/docs/tags/x86.html index dab538b..501b634 100644 --- a/docs/tags/x86.html +++ b/docs/tags/x86.html @@ -2,14 +2,26 @@ - + + + + + "x86" + + + + + + + - "x86" - @@ -29,18 +41,25 @@ - -
    -
    + + +
    @@ -67,6 +86,7 @@ +
    -- cgit v1.2.3

    tag: + # + # + # + _xml_oneliner_re = _xml_oneliner_re_from_tab_width(self.tab_width) + text = _xml_oneliner_re.sub(hash_html_block_sub, text) + + return text + + def _strict_tag_block_sub(self, text, html_tags_re, callback, allow_indent=False): + ''' + Finds and substitutes HTML blocks within blocks of text + + Args: + text: the text to search + html_tags_re: a regex pattern of HTML block tags to match against. + For example, `Markdown._block_tags_a` + callback: callback function that receives the found HTML text block + allow_indent: allow matching HTML blocks that are not completely outdented + ''' + tag_count = 0 + current_tag = html_tags_re + block = '' + result = '' + + for chunk in text.splitlines(True): + is_markup = re.match( + r'^(\s{0,%s})(?:(?=))?(?)' % ('' if allow_indent else '0', current_tag), chunk + ) + block += chunk + + if is_markup: + if chunk.startswith('%s' % tag_name, text)) == len(re.findall('' % tag_name, text)) + + @mark_stage(Stage.LINK_DEFS) + def _strip_link_definitions(self, text): + # Strips link definitions from text, stores the URLs and titles in + # hash references. + less_than_tab = self.tab_width - 1 + + # Link defs are in the form: + # [id]: url "optional title" + _link_def_re = re.compile(r""" + ^[ ]{0,%d}\[(.+)\]: # id = \1 + [ \t]* + \n? # maybe *one* newline + [ \t]* + ? # url = \2 + [ \t]* + (?: + \n? # maybe one newline + [ \t]* + (?<=\s) # lookbehind for whitespace + ['"(] + ([^\n]*) # title = \3 + ['")] + [ \t]* + )? # title is optional + (?:\n+|\Z) + """ % less_than_tab, re.X | re.M | re.U) + return _link_def_re.sub(self._extract_link_def_sub, text) + + def _extract_link_def_sub(self, match): + id, url, title = match.groups() + key = id.lower() # Link IDs are case-insensitive + self.urls[key] = self._encode_amps_and_angles(url) + if title: + self.titles[key] = title + return "" + + def _extract_footnote_def_sub(self, match): + id, text = match.groups() + text = _dedent(text, skip_first_line=not text.startswith('\n')).strip() + normed_id = re.sub(r'\W', '-', id) + # Ensure footnote text ends with a couple newlines (for some + # block gamut matches). + self.footnotes[normed_id] = text + "\n\n" + return "" + + def _strip_footnote_definitions(self, text): + """A footnote definition looks like this: + + [^note-id]: Text of the note. + + May include one or more indented paragraphs. + + Where, + - The 'note-id' can be pretty much anything, though typically it + is the number of the footnote. + - The first paragraph may start on the next line, like so: + + [^note-id]: + Text of the note. + """ + less_than_tab = self.tab_width - 1 + footnote_def_re = re.compile(r''' + ^[ ]{0,%d}\[\^(.+)\]: # id = \1 + [ \t]* + ( # footnote text = \2 + # First line need not start with the spaces. + (?:\s*.*\n+) + (?: + (?:[ ]{%d} | \t) # Subsequent lines must be indented. + .*\n+ + )* + ) + # Lookahead for non-space at line-start, or end of doc. + (?:(?=^[ ]{0,%d}\S)|\Z) + ''' % (less_than_tab, self.tab_width, self.tab_width), + re.X | re.M) + return footnote_def_re.sub(self._extract_footnote_def_sub, text) + + _hr_re = re.compile(r'^[ ]{0,3}([-_*])[ ]{0,2}(\1[ ]{0,2}){2,}$', re.M) + + @mark_stage(Stage.BLOCK_GAMUT) + def _run_block_gamut(self, text): + # These are all the transformations that form block-level + # tags like paragraphs, headers, and list items. + + text = self._do_headers(text) + + # Do Horizontal Rules: + # On the number of spaces in horizontal rules: The spec is fuzzy: "If + # you wish, you may use spaces between the hyphens or asterisks." + # Markdown.pl 1.0.1's hr regexes limit the number of spaces between the + # hr chars to one or two. We'll reproduce that limit here. + hr = "\n tags around block-level tags. + text = self._hash_html_blocks(text) + + text = self._form_paragraphs(text) + + return text + + @mark_stage(Stage.SPAN_GAMUT) + def _run_span_gamut(self, text): + # These are all the transformations that occur *within* block-level + # tags like paragraphs, headers, and list items. + + text = self._do_code_spans(text) + + text = self._escape_special_chars(text) + + # Process anchor and image tags. + text = self._do_links(text) + + # Make links out of things like `` + # Must come after _do_links(), because you can use < and > + # delimiters in inline links like [this](). + text = self._do_auto_links(text) + + text = self._encode_amps_and_angles(text) + + text = self._do_italics_and_bold(text) + + # Do hard breaks + text = re.sub(r" {2,}\n(?!\<(?:\/?(ul|ol|li))\>)", " + | + # auto-link (e.g., ) + <[\w~:/?#\[\]@!$&'\(\)*+,;%=\.\\-]+> + | + # comment + | + <\?.*?\?> # processing instruction + ) + ) + """, re.X) + + @mark_stage(Stage.ESCAPE_SPECIAL) + def _escape_special_chars(self, text): + # Python markdown note: the HTML tokenization here differs from + # that in Markdown.pl, hence the behaviour for subtle cases can + # differ (I believe the tokenizer here does a better job because + # it isn't susceptible to unmatched '<' and '>' in HTML tags). + # Note, however, that '>' is not allowed in an auto-link URL + # here. + lead_escape_re = re.compile(r'^((?:\\\\)*(?!\\))') + escaped = [] + is_html_markup = False + for token in self._sorta_html_tokenize_re.split(text): + # check token is preceded by 0 or more PAIRS of escapes, because escape pairs + # escape themselves and don't affect the token + if is_html_markup and lead_escape_re.match(token): + # Within tags/HTML-comments/auto-links, encode * and _ + # so they don't conflict with their use in Markdown for + # italics and strong. We're replacing each such + # character with its corresponding MD5 checksum value; + # this is likely overkill, but it should prevent us from + # colliding with the escape values by accident. + escape_seq, token = lead_escape_re.split(token)[1:] or ('', token) + escaped.append( + escape_seq.replace('\\\\', self._escape_table['\\']) + + token.replace('*', self._escape_table['*']) + .replace('_', self._escape_table['_']) + ) + else: + escaped.append(self._encode_backslash_escapes(token.replace('\\<', '<'))) + is_html_markup = not is_html_markup + return ''.join(escaped) + + @mark_stage(Stage.HASH_HTML) + def _hash_html_spans(self, text): + # Used for safe_mode. + + def _is_auto_link(s): + if ':' in s and self._auto_link_re.match(s): + return True + elif '@' in s and self._auto_email_link_re.match(s): + return True + return False + + def _is_code_span(index, token): + try: + if token == '': + peek_tokens = split_tokens[index: index + 3] + elif token == '': + peek_tokens = split_tokens[index - 2: index + 1] + else: + return False + except IndexError: + return False + + return re.match(r'md5-[A-Fa-f0-9]{32}', ''.join(peek_tokens)) + + def _is_comment(token): + if self.safe_mode == 'replace': + # don't bother processing each section of comment in replace mode. Just do the whole thing + return + return re.match(r'()', token) + + def _hash(token): + key = _hash_text(token) + self.html_spans[key] = token + return key + + tokens = [] + split_tokens = self._sorta_html_tokenize_re.split(text) + is_html_markup = False + for index, token in enumerate(split_tokens): + if is_html_markup and not _is_auto_link(token) and not _is_code_span(index, token): + is_comment = _is_comment(token) + if is_comment: + tokens.append(_hash(self._sanitize_html(is_comment.group(1)))) + # sanitise but leave comment body intact for further markdown processing + tokens.append(self._sanitize_html(is_comment.group(2))) + tokens.append(_hash(self._sanitize_html(is_comment.group(3)))) + else: + tokens.append(_hash(self._sanitize_html(token))) + else: + tokens.append(self._encode_incomplete_tags(token)) + is_html_markup = not is_html_markup + return ''.join(tokens) + + def _unhash_html_spans(self, text): + for key, sanitized in list(self.html_spans.items()): + text = text.replace(key, sanitized) + return text + + def _sanitize_html(self, s): + if self.safe_mode == "replace": + return self.html_removed_text + elif self.safe_mode == "escape": + replacements = [ + ('&', '&'), + ('<', '<'), + ('>', '>'), + ] + for before, after in replacements: + s = s.replace(before, after) + return s + else: + raise MarkdownError("invalid value for 'safe_mode': %r (must be " + "'escape' or 'replace')" % self.safe_mode) + + _inline_link_title = re.compile(r''' + ( # \1 + [ \t]+ + (['"]) # quote char = \2 + (?P.*?) + \2 + )? # title is optional + \)$ + ''', re.X | re.S) + _tail_of_reference_link_re = re.compile(r''' + # Match tail of: [text][id] + [ ]? # one optional space + (?:\n[ ]*)? # one optional newline followed by spaces + \[ + (?P<id>.*?) + \] + ''', re.X | re.S) + + _whitespace = re.compile(r'\s*') + + _strip_anglebrackets = re.compile(r'<(.*)>.*') + + def _find_non_whitespace(self, text, start): + """Returns the index of the first non-whitespace character in text + after (and including) start + """ + match = self._whitespace.match(text, start) + return match.end() + + def _find_balanced(self, text, start, open_c, close_c): + """Returns the index where the open_c and close_c characters balance + out - the same number of open_c and close_c are encountered - or the + end of string if it's reached before the balance point is found. + """ + i = start + l = len(text) + count = 1 + while count > 0 and i < l: + if text[i] == open_c: + count += 1 + elif text[i] == close_c: + count -= 1 + i += 1 + return i + + def _extract_url_and_title(self, text, start): + """Extracts the url and (optional) title from the tail of a link""" + # text[start] equals the opening parenthesis + idx = self._find_non_whitespace(text, start+1) + if idx == len(text): + return None, None, None + end_idx = idx + has_anglebrackets = text[idx] == "<" + if has_anglebrackets: + end_idx = self._find_balanced(text, end_idx+1, "<", ">") + end_idx = self._find_balanced(text, end_idx, "(", ")") + match = self._inline_link_title.search(text, idx, end_idx) + if not match: + return None, None, None + url, title = text[idx:match.start()], match.group("title") + if has_anglebrackets: + url = self._strip_anglebrackets.sub(r'\1', url) + return url, title, end_idx + + # https://developer.mozilla.org/en-US/docs/web/http/basics_of_http/data_urls + # https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types + _data_url_re = re.compile(r''' + data: + # in format type/subtype;parameter=optional + (?P<mime>\w+/[\w+\.-]+(?:;\w+=[\w+\.-]+)?)? + # optional base64 token + (?P<token>;base64)? + ,(?P<data>.*) + ''', re.X) + + def _protect_url(self, url): + ''' + Function that passes a URL through `_html_escape_url` to remove any nasty characters, + and then hashes the now "safe" URL to prevent other safety mechanisms from tampering + with it (eg: escaping "&" in URL parameters) + ''' + data_url = self._data_url_re.match(url) + charset = None + if data_url is not None: + mime = data_url.group('mime') or '' + if mime.startswith('image/') and data_url.group('token') == ';base64': + charset='base64' + url = _html_escape_url(url, safe_mode=self.safe_mode, charset=charset) + key = _hash_text(url) + self._escape_table[url] = key + return key + + _safe_protocols = r'(?:https?|ftp):\/\/|(?:mailto|tel):' + + @property + def _safe_href(self): + ''' + _safe_href is adapted from pagedown's Markdown.Sanitizer.js + From: https://github.com/StackExchange/pagedown/blob/master/LICENSE.txt + Original Showdown code copyright (c) 2007 John Fraser + Modifications and bugfixes (c) 2009 Dana Robinson + Modifications and bugfixes (c) 2009-2014 Stack Exchange Inc. + ''' + safe = r'-\w' + # omitted ['"<>] for XSS reasons + less_safe = r'#/\.!#$%&\(\)\+,/:;=\?@\[\]^`\{\}\|~' + # dot seperated hostname, optional port number, not followed by protocol seperator + domain = r'(?:[%s]+(?:\.[%s]+)*)(?:(?<!tel):\d+/?)?(?![^:/]*:/*)' % (safe, safe) + fragment = r'[%s]*' % (safe + less_safe) + + return re.compile(r'^(?:(%s)?(%s)(%s)|(#|\.{,2}/)(%s))$' % (self._safe_protocols, domain, fragment, fragment), re.I) + + @mark_stage(Stage.LINKS) + def _do_links(self, text): + """Turn Markdown link shortcuts into XHTML <a> and <img> tags. + + This is a combination of Markdown.pl's _DoAnchors() and + _DoImages(). They are done together because that simplified the + approach. It was necessary to use a different approach than + Markdown.pl because of the lack of atomic matching support in + Python's regex engine used in $g_nested_brackets. + """ + MAX_LINK_TEXT_SENTINEL = 3000 # markdown2 issue 24 + + # `anchor_allowed_pos` is used to support img links inside + # anchors, but not anchors inside anchors. An anchor's start + # pos must be `>= anchor_allowed_pos`. + anchor_allowed_pos = 0 + + curr_pos = 0 + while True: # Handle the next link. + # The next '[' is the start of: + # - an inline anchor: [text](url "title") + # - a reference anchor: [text][id] + # - an inline img: ![text](url "title") + # - a reference img: ![text][id] + # - a footnote ref: [^id] + # (Only if 'footnotes' extra enabled) + # - a footnote defn: [^id]: ... + # (Only if 'footnotes' extra enabled) These have already + # been stripped in _strip_footnote_definitions() so no + # need to watch for them. + # - a link definition: [id]: url "title" + # These have already been stripped in + # _strip_link_definitions() so no need to watch for them. + # - not markup: [...anything else... + try: + start_idx = text.index('[', curr_pos) + except ValueError: + break + text_length = len(text) + + # Find the matching closing ']'. + # Markdown.pl allows *matching* brackets in link text so we + # will here too. Markdown.pl *doesn't* currently allow + # matching brackets in img alt text -- we'll differ in that + # regard. + bracket_depth = 0 + for p in range(start_idx+1, min(start_idx+MAX_LINK_TEXT_SENTINEL, + text_length)): + ch = text[p] + if ch == ']': + bracket_depth -= 1 + if bracket_depth < 0: + break + elif ch == '[': + bracket_depth += 1 + else: + # Closing bracket not found within sentinel length. + # This isn't markup. + curr_pos = start_idx + 1 + continue + link_text = text[start_idx+1:p] + + # Fix for issue 341 - Injecting XSS into link text + if self.safe_mode: + link_text = self._hash_html_spans(link_text) + link_text = self._unhash_html_spans(link_text) + + # Possibly a footnote ref? + if "footnotes" in self.extras and link_text.startswith("^"): + normed_id = re.sub(r'\W', '-', link_text[1:]) + if normed_id in self.footnotes: + self.footnote_ids.append(normed_id) + result = '<sup class="footnote-ref" id="fnref-%s">' \ + '<a href="#fn-%s">%s</a></sup>' \ + % (normed_id, normed_id, len(self.footnote_ids)) + text = text[:start_idx] + result + text[p+1:] + else: + # This id isn't defined, leave the markup alone. + curr_pos = p+1 + continue + + # Now determine what this is by the remainder. + p += 1 + + # Inline anchor or img? + if text[p:p + 1] == '(': # attempt at perf improvement + url, title, url_end_idx = self._extract_url_and_title(text, p) + if url is not None: + # Handle an inline anchor or img. + is_img = start_idx > 0 and text[start_idx-1] == "!" + if is_img: + start_idx -= 1 + + # We've got to encode these to avoid conflicting + # with italics/bold. + url = url.replace('*', self._escape_table['*']) \ + .replace('_', self._escape_table['_']) + if title: + title_str = ' title="%s"' % ( + _xml_escape_attr(title) + .replace('*', self._escape_table['*']) + .replace('_', self._escape_table['_'])) + else: + title_str = '' + if is_img: + img_class_str = self._html_class_str_from_tag("img") + result = '<img src="%s" alt="%s"%s%s%s' \ + % (self._protect_url(url), + _xml_escape_attr(link_text), + title_str, + img_class_str, + self.empty_element_suffix) + if "smarty-pants" in self.extras: + result = result.replace('"', self._escape_table['"']) + curr_pos = start_idx + len(result) + anchor_allowed_pos = start_idx + len(result) + text = text[:start_idx] + result + text[url_end_idx:] + elif start_idx >= anchor_allowed_pos: + safe_link = self._safe_href.match(url) + if self.safe_mode and not safe_link: + result_head = '<a href="#"%s>' % (title_str) + else: + result_head = '<a href="%s"%s>' % (self._protect_url(url), title_str) + result = '%s%s</a>' % (result_head, link_text) + if "smarty-pants" in self.extras: + result = result.replace('"', self._escape_table['"']) + # <img> allowed from curr_pos on, <a> from + # anchor_allowed_pos on. + curr_pos = start_idx + len(result_head) + anchor_allowed_pos = start_idx + len(result) + text = text[:start_idx] + result + text[url_end_idx:] + else: + # Anchor not allowed here. + curr_pos = start_idx + 1 + continue + + # Reference anchor or img? + else: + match = self._tail_of_reference_link_re.match(text, p) + if match: + # Handle a reference-style anchor or img. + is_img = start_idx > 0 and text[start_idx-1] == "!" + if is_img: + start_idx -= 1 + link_id = match.group("id").lower() + if not link_id: + link_id = link_text.lower() # for links like [this][] + if link_id in self.urls: + url = self.urls[link_id] + # We've got to encode these to avoid conflicting + # with italics/bold. + url = url.replace('*', self._escape_table['*']) \ + .replace('_', self._escape_table['_']) + title = self.titles.get(link_id) + if title: + title = _xml_escape_attr(title) \ + .replace('*', self._escape_table['*']) \ + .replace('_', self._escape_table['_']) + title_str = ' title="%s"' % title + else: + title_str = '' + if is_img: + img_class_str = self._html_class_str_from_tag("img") + result = '<img src="%s" alt="%s"%s%s%s' \ + % (self._protect_url(url), + _xml_escape_attr(link_text), + title_str, + img_class_str, + self.empty_element_suffix) + if "smarty-pants" in self.extras: + result = result.replace('"', self._escape_table['"']) + curr_pos = start_idx + len(result) + text = text[:start_idx] + result + text[match.end():] + elif start_idx >= anchor_allowed_pos: + if self.safe_mode and not self._safe_href.match(url): + result_head = '<a href="#"%s>' % (title_str) + else: + result_head = '<a href="%s"%s>' % (self._protect_url(url), title_str) + result = '%s%s</a>' % (result_head, link_text) + if "smarty-pants" in self.extras: + result = result.replace('"', self._escape_table['"']) + # <img> allowed from curr_pos on, <a> from + # anchor_allowed_pos on. + curr_pos = start_idx + len(result_head) + anchor_allowed_pos = start_idx + len(result) + text = text[:start_idx] + result + text[match.end():] + else: + # Anchor not allowed here. + curr_pos = start_idx + 1 + else: + # This id isn't defined, leave the markup alone. + # set current pos to end of link title and continue from there + curr_pos = p + continue + + # Otherwise, it isn't markup. + curr_pos = start_idx + 1 + + return text + + def header_id_from_text(self, text, prefix, n): + """Generate a header id attribute value from the given header + HTML content. + + This is only called if the "header-ids" extra is enabled. + Subclasses may override this for different header ids. + + @param text {str} The text of the header tag + @param prefix {str} The requested prefix for header ids. This is the + value of the "header-ids" extra key, if any. Otherwise, None. + @param n {int} The <hN> tag number, i.e. `1` for an <h1> tag. + @returns {str} The value for the header tag's "id" attribute. Return + None to not have an id attribute and to exclude this header from + the TOC (if the "toc" extra is specified). + """ + header_id = _slugify(text) + if prefix and isinstance(prefix, str): + header_id = prefix + '-' + header_id + + self._count_from_header_id[header_id] += 1 + if 0 == len(header_id) or self._count_from_header_id[header_id] > 1: + header_id += '-%s' % self._count_from_header_id[header_id] + + return header_id + + def _header_id_exists(self, text): + header_id = _slugify(text) + prefix = self.extras['header-ids'].get('prefix') + if prefix and isinstance(prefix, str): + header_id = prefix + '-' + header_id + return header_id in self._count_from_header_id or header_id in map(lambda x: x[1], self._toc) + + def _toc_add_entry(self, level, id, name): + if level > self._toc_depth: + return + if self._toc is None: + self._toc = [] + self._toc.append((level, id, self._unescape_special_chars(name))) + + _h_re_base = r''' + (^(.+)[ \t]{0,99}\n(=+|-+)[ \t]*\n+) + | + (^(\#{1,6}) # \1 = string of #'s + [ \t]%s + (.+?) # \2 = Header text + [ \t]{0,99} + (?<!\\) # ensure not an escaped trailing '#' + \#* # optional closing #'s (not counted) + \n+ + ) + ''' + + _h_re = re.compile(_h_re_base % '*', re.X | re.M) + _h_re_tag_friendly = re.compile(_h_re_base % '+', re.X | re.M) + + def _h_sub(self, match): + '''Handles processing markdown headers''' + if match.group(1) is not None and match.group(3) == "-": + return match.group(1) + elif match.group(1) is not None: + # Setext header + n = {"=": 1, "-": 2}[match.group(3)[0]] + header_group = match.group(2) + else: + # atx header + n = len(match.group(5)) + header_group = match.group(6) + + demote_headers = self.extras.get("demote-headers") + if demote_headers: + n = min(n + demote_headers, 6) + header_id_attr = "" + if "header-ids" in self.extras: + header_id = self.header_id_from_text(header_group, + self.extras["header-ids"].get('prefix'), n) + if header_id: + header_id_attr = ' id="%s"' % header_id + html = self._run_span_gamut(header_group) + if "toc" in self.extras and header_id: + self._toc_add_entry(n, header_id, html) + return "<h%d%s>%s</h%d>\n\n" % (n, header_id_attr, html, n) + + _h_tag_re = re.compile(r''' + ^<h([1-6])(.*)> # \1 tag num, \2 attrs + (.*) # \3 text + </h\1> + ''', re.X | re.M) + + def _h_tag_sub(self, match): + '''Different to `_h_sub` in that this function handles existing HTML headers''' + text = match.string[match.start(): match.end()] + h_level = int(match.group(1)) + # extract id= attr from tag, trying to account for regex "misses" + id_attr = (re.match(r'.*?id=(\S+)?.*', match.group(2) or '') or '') + if id_attr: + # if id attr exists, extract that + id_attr = id_attr.group(1) or '' + id_attr = id_attr.strip('\'" ') + h_text = match.group(3) + + # check if header was already processed (ie: was a markdown header rather than HTML) + if id_attr and self._header_id_exists(id_attr): + return text + + # generate new header id if none existed + header_id = id_attr or self.header_id_from_text(h_text, self.extras['header-ids'].get('prefix'), h_level) + if "toc" in self.extras: + self._toc_add_entry(h_level, header_id, h_text) + if header_id and not id_attr: + # '<h[digit]' + new ID + '...' + return text[:3] + ' id="%s"' % header_id + text[3:] + return text + + @mark_stage(Stage.HEADERS) + def _do_headers(self, text): + # Setext-style headers: + # Header 1 + # ======== + # + # Header 2 + # -------- + + # atx-style headers: + # # Header 1 + # ## Header 2 + # ## Header 2 with closing hashes ## + # ... + # ###### Header 6 + + if 'tag-friendly' in self.extras: + return self._h_re_tag_friendly.sub(self._h_sub, text) + return self._h_re.sub(self._h_sub, text) + + _marker_ul_chars = '*+-' + _marker_any = r'(?:[%s]|\d+\.)' % _marker_ul_chars + _marker_ul = '(?:[%s])' % _marker_ul_chars + _marker_ol = r'(?:\d+\.)' + + def _list_sub(self, match): + lst = match.group(1) + lst_type = match.group(4) in self._marker_ul_chars and "ul" or "ol" + + if lst_type == 'ol' and match.group(4) != '1.': + # if list doesn't start at 1 then set the ol start attribute + lst_opts = ' start="%s"' % match.group(4)[:-1] + else: + lst_opts = '' + + lst_opts = lst_opts + self._html_class_str_from_tag(lst_type) + + result = self._process_list_items(lst) + if self.list_level: + return "<%s%s>\n%s</%s>\n" % (lst_type, lst_opts, result, lst_type) + else: + return "<%s%s>\n%s</%s>\n\n" % (lst_type, lst_opts, result, lst_type) + + @mark_stage(Stage.LISTS) + def _do_lists(self, text): + # Form HTML ordered (numbered) and unordered (bulleted) lists. + + # Iterate over each *non-overlapping* list match. + pos = 0 + while True: + # Find the *first* hit for either list style (ul or ol). We + # match ul and ol separately to avoid adjacent lists of different + # types running into each other (see issue #16). + hits = [] + for marker_pat in (self._marker_ul, self._marker_ol): + less_than_tab = self.tab_width - 1 + other_marker_pat = self._marker_ul if marker_pat == self._marker_ol else self._marker_ol + whole_list = r''' + ( # \1 = whole list + ( # \2 + ([ ]{0,%d}) # \3 = the indentation level of the list item marker + (%s) # \4 = first list item marker + [ \t]+ + (?!\ *\4\ ) # '- - - ...' isn't a list. See 'not_quite_a_list' test case. + ) + (?:.+?) + ( # \5 + \Z + | + \n{2,} + (?=\S) + (?! # Negative lookahead for another list item marker + [ \t]* + %s[ \t]+ + ) + | + \n+ + (?= + \3 # lookahead for a different style of list item marker + %s[ \t]+ + ) + ) + ) + ''' % (less_than_tab, marker_pat, marker_pat, other_marker_pat) + if self.list_level: # sub-list + list_re = re.compile("^"+whole_list, re.X | re.M | re.S) + else: + list_re = re.compile(r"(?:(?<=\n\n)|\A\n?)"+whole_list, + re.X | re.M | re.S) + match = list_re.search(text, pos) + if match: + hits.append((match.start(), match)) + if not hits: + break + hits.sort() + match = hits[0][1] + start, end = match.span() + middle = self._list_sub(match) + text = text[:start] + middle + text[end:] + pos = start + len(middle) # start pos for next attempted match + + return text + + _list_item_re = re.compile(r''' + (\n)? # leading line = \1 + (^[ \t]*) # leading whitespace = \2 + (?P<marker>%s) [ \t]+ # list marker = \3 + ((?:.+?) # list item text = \4 + (\n{1,2})) # eols = \5 + (?= \n* (\Z | \2 (?P<next_marker>%s) [ \t]+)) + ''' % (_marker_any, _marker_any), + re.M | re.X | re.S) + + _task_list_item_re = re.compile(r''' + (\[[\ xX]\])[ \t]+ # tasklist marker = \1 + (.*) # list item text = \2 + ''', re.M | re.X | re.S) + + _task_list_warpper_str = r'<input type="checkbox" class="task-list-item-checkbox" %sdisabled> %s' + + def _task_list_item_sub(self, match): + marker = match.group(1) + item_text = match.group(2) + if marker in ['[x]','[X]']: + return self._task_list_warpper_str % ('checked ', item_text) + elif marker == '[ ]': + return self._task_list_warpper_str % ('', item_text) + + _last_li_endswith_two_eols = False + def _list_item_sub(self, match): + item = match.group(4) + leading_line = match.group(1) + if leading_line or "\n\n" in item or self._last_li_endswith_two_eols: + item = self._uniform_outdent(item, min_outdent=' ', max_outdent=self.tab)[1] + item = self._run_block_gamut(item) + else: + # Recursion for sub-lists: + item = self._do_lists(self._uniform_outdent(item, min_outdent=' ')[1]) + if item.endswith('\n'): + item = item[:-1] + item = self._run_span_gamut(item) + self._last_li_endswith_two_eols = (len(match.group(5)) == 2) + + if "task_list" in self.extras: + item = self._task_list_item_re.sub(self._task_list_item_sub, item) + + return "<li>%s</li>\n" % item + + def _process_list_items(self, list_str): + # Process the contents of a single ordered or unordered list, + # splitting it into individual list items. + + # The $g_list_level global keeps track of when we're inside a list. + # Each time we enter a list, we increment it; when we leave a list, + # we decrement. If it's zero, we're not in a list anymore. + # + # We do this because when we're not inside a list, we want to treat + # something like this: + # + # I recommend upgrading to version + # 8. Oops, now this line is treated + # as a sub-list. + # + # As a single paragraph, despite the fact that the second line starts + # with a digit-period-space sequence. + # + # Whereas when we're inside a list (or sub-list), that line will be + # treated as the start of a sub-list. What a kludge, huh? This is + # an aspect of Markdown's syntax that's hard to parse perfectly + # without resorting to mind-reading. Perhaps the solution is to + # change the syntax rules such that sub-lists must start with a + # starting cardinal number; e.g. "1." or "a.". + self.list_level += 1 + self._last_li_endswith_two_eols = False + list_str = list_str.rstrip('\n') + '\n' + list_str = self._list_item_re.sub(self._list_item_sub, list_str) + self.list_level -= 1 + return list_str + + def _get_pygments_lexer(self, lexer_name): + try: + from pygments import lexers, util + except ImportError: + return None + try: + return lexers.get_lexer_by_name(lexer_name) + except util.ClassNotFound: + return None + + def _color_with_pygments(self, codeblock, lexer, **formatter_opts): + import pygments + import pygments.formatters + + class HtmlCodeFormatter(pygments.formatters.HtmlFormatter): + def _wrap_code(self, inner): + """A function for use in a Pygments Formatter which + wraps in <code> tags. + """ + yield 0, "<code>" + for tup in inner: + yield tup + yield 0, "</code>" + + def _add_newline(self, inner): + # Add newlines around the inner contents so that _strict_tag_block_re matches the outer div. + yield 0, "\n" + yield from inner + yield 0, "\n" + + def wrap(self, source, outfile=None): + """Return the source with a code, pre, and div.""" + if outfile is None: + # pygments >= 2.12 + return self._add_newline(self._wrap_pre(self._wrap_code(source))) + else: + # pygments < 2.12 + return self._wrap_div(self._add_newline(self._wrap_pre(self._wrap_code(source)))) + + formatter_opts.setdefault("cssclass", "codehilite") + formatter = HtmlCodeFormatter(**formatter_opts) + return pygments.highlight(codeblock, lexer, formatter) + + def _code_block_sub(self, match): + codeblock = match.group(1) + codeblock = self._outdent(codeblock) + codeblock = self._detab(codeblock) + codeblock = codeblock.lstrip('\n') # trim leading newlines + codeblock = codeblock.rstrip() # trim trailing whitespace + + pre_class_str = self._html_class_str_from_tag("pre") + code_class_str = self._html_class_str_from_tag("code") + + codeblock = self._encode_code(codeblock) + + return "\n<pre%s><code%s>%s\n</code></pre>\n" % ( + pre_class_str, code_class_str, codeblock) + + def _html_class_str_from_tag(self, tag): + """Get the appropriate ' class="..."' string (note the leading + space), if any, for the given tag. + """ + if "html-classes" not in self.extras: + return "" + try: + html_classes_from_tag = self.extras["html-classes"] + except TypeError: + return "" + else: + if isinstance(html_classes_from_tag, dict): + if tag in html_classes_from_tag: + return ' class="%s"' % html_classes_from_tag[tag] + return "" + + @mark_stage(Stage.CODE_BLOCKS) + def _do_code_blocks(self, text): + """Process Markdown `<pre><code>` blocks.""" + code_block_re = re.compile(r''' + (?:\n\n|\A\n?) + ( # $1 = the code block -- one or more lines, starting with a space/tab + (?: + (?:[ ]{%d} | \t) # Lines must start with a tab or a tab-width of spaces + .*\n+ + )+ + ) + ((?=^[ ]{0,%d}\S)|\Z) # Lookahead for non-space at line-start, or end of doc + # Lookahead to make sure this block isn't already in a code block. + # Needed when syntax highlighting is being used. + (?!([^<]|<(/?)span)*\</code\>) + ''' % (self.tab_width, self.tab_width), + re.M | re.X) + return code_block_re.sub(self._code_block_sub, text) + + # Rules for a code span: + # - backslash escapes are not interpreted in a code span + # - to include one or or a run of more backticks the delimiters must + # be a longer run of backticks + # - cannot start or end a code span with a backtick; pad with a + # space and that space will be removed in the emitted HTML + # See `test/tm-cases/escapes.text` for a number of edge-case + # examples. + _code_span_re = re.compile(r''' + (?<!\\) + (`+) # \1 = Opening run of ` + (?!`) # See Note A test/tm-cases/escapes.text + (.+?) # \2 = The code block + (?<!`) + \1 # Matching closer + (?!`) + ''', re.X | re.S) + + def _code_span_sub(self, match): + c = match.group(2).strip(" \t") + c = self._encode_code(c) + return "<code%s>%s</code>" % (self._html_class_str_from_tag("code"), c) + + @mark_stage(Stage.CODE_SPANS) + def _do_code_spans(self, text): + # * Backtick quotes are used for <code></code> spans. + # + # * You can use multiple backticks as the delimiters if you want to + # include literal backticks in the code span. So, this input: + # + # Just type ``foo `bar` baz`` at the prompt. + # + # Will translate to: + # + # <p>Just type <code>foo `bar` baz</code> at the prompt.</p> + # + # There's no arbitrary limit to the number of backticks you + # can use as delimters. If you need three consecutive backticks + # in your code, use four for delimiters, etc. + # + # * You can use spaces to get literal backticks at the edges: + # + # ... type `` `bar` `` ... + # + # Turns to: + # + # ... type <code>`bar`</code> ... + return self._code_span_re.sub(self._code_span_sub, text) + + def _encode_code(self, text): + """Encode/escape certain characters inside Markdown code runs. + The point is that in code, these characters are literals, + and lose their special Markdown meanings. + """ + replacements = [ + # Encode all ampersands; HTML entities are not + # entities within a Markdown code span. + ('&', '&'), + # Do the angle bracket song and dance: + ('<', '<'), + ('>', '>'), + ] + for before, after in replacements: + text = text.replace(before, after) + hashed = _hash_text(text) + self._code_table[text] = hashed + return hashed + + _strong_re = re.compile(r"(\*\*|__)(?=\S)(.+?[*_]?)(?<=\S)\1", re.S) + _em_re = re.compile(r"(\*|_)(?=\S)(.*?\S)\1", re.S) + + @mark_stage(Stage.ITALIC_AND_BOLD) + def _do_italics_and_bold(self, text): + # <strong> must go first: + text = self._strong_re.sub(r"<strong>\2</strong>", text) + text = self._em_re.sub(r"<em>\2</em>", text) + return text + + _block_quote_base = r''' + ( # Wrap whole match in \1 + ( + ^[ \t]*>%s[ \t]? # '>' at the start of a line + .+\n # rest of the first line + (.+\n)* # subsequent consecutive lines + )+ + ) + ''' + _block_quote_re = re.compile(_block_quote_base % '', re.M | re.X) + _block_quote_re_spoiler = re.compile(_block_quote_base % '[ \t]*?!?', re.M | re.X) + _bq_one_level_re = re.compile('^[ \t]*>[ \t]?', re.M) + _bq_one_level_re_spoiler = re.compile('^[ \t]*>[ \t]*?![ \t]?', re.M) + _bq_all_lines_spoilers = re.compile(r'\A(?:^[ \t]*>[ \t]*?!.*[\n\r]*)+\Z', re.M) + _html_pre_block_re = re.compile(r'(\s*<pre>.+?</pre>)', re.S) + def _dedent_two_spaces_sub(self, match): + return re.sub(r'(?m)^ ', '', match.group(1)) + + def _block_quote_sub(self, match): + bq = match.group(1) + is_spoiler = 'spoiler' in self.extras and self._bq_all_lines_spoilers.match(bq) + # trim one level of quoting + if is_spoiler: + bq = self._bq_one_level_re_spoiler.sub('', bq) + else: + bq = self._bq_one_level_re.sub('', bq) + # trim whitespace-only lines + bq = self._ws_only_line_re.sub('', bq) + bq = self._run_block_gamut(bq) # recurse + + bq = re.sub('(?m)^', ' ', bq) + # These leading spaces screw with <pre> content, so we need to fix that: + bq = self._html_pre_block_re.sub(self._dedent_two_spaces_sub, bq) + + if is_spoiler: + return '<blockquote class="spoiler">\n%s\n</blockquote>\n\n' % bq + else: + return '<blockquote>\n%s\n</blockquote>\n\n' % bq + + @mark_stage(Stage.BLOCK_QUOTES) + def _do_block_quotes(self, text): + if '>' not in text: + return text + if 'spoiler' in self.extras: + return self._block_quote_re_spoiler.sub(self._block_quote_sub, text) + else: + return self._block_quote_re.sub(self._block_quote_sub, text) + + @mark_stage(Stage.PARAGRAPHS) + def _form_paragraphs(self, text): + # Strip leading and trailing lines: + text = text.strip('\n') + + # Wrap <p> tags. + grafs = [] + for i, graf in enumerate(re.split(r"\n{2,}", text)): + if graf in self.html_blocks: + # Unhashify HTML blocks + grafs.append(self.html_blocks[graf]) + else: + cuddled_list = None + if "cuddled-lists" in self.extras: + # Need to put back trailing '\n' for `_list_item_re` + # match at the end of the paragraph. + li = self._list_item_re.search(graf + '\n') + # Two of the same list marker in this paragraph: a likely + # candidate for a list cuddled to preceding paragraph + # text (issue 33). Note the `[-1]` is a quick way to + # consider numeric bullets (e.g. "1." and "2.") to be + # equal. + if (li and len(li.group(2)) <= 3 + and ( + (li.group("next_marker") and li.group("marker")[-1] == li.group("next_marker")[-1]) + or + li.group("next_marker") is None + ) + ): + start = li.start() + cuddled_list = self._do_lists(graf[start:]).rstrip("\n") + assert re.match(r'^<(?:ul|ol).*?>', cuddled_list) + graf = graf[:start] + + # Wrap <p> tags. + graf = self._run_span_gamut(graf) + grafs.append("<p%s>" % self._html_class_str_from_tag('p') + graf.lstrip(" \t") + "</p>") + + if cuddled_list: + grafs.append(cuddled_list) + + return "\n\n".join(grafs) + + def _add_footnotes(self, text): + if self.footnotes: + footer = [ + '<div class="footnotes">', + '<hr' + self.empty_element_suffix, + '<ol>', + ] + + if not self.footnote_title: + self.footnote_title = "Jump back to footnote %d in the text." + if not self.footnote_return_symbol: + self.footnote_return_symbol = "↩" + + # self.footnotes is generated in _strip_footnote_definitions, which runs re.sub on the whole + # text. This means that the dict keys are inserted in order of appearance. Use the dict to + # sort footnote ids by that same order + self.footnote_ids.sort(key=lambda a: list(self.footnotes.keys()).index(a)) + for i, id in enumerate(self.footnote_ids): + if i != 0: + footer.append('') + footer.append('<li id="fn-%s">' % id) + footer.append(self._run_block_gamut(self.footnotes[id])) + try: + backlink = ('<a href="#fnref-%s" ' + + 'class="footnoteBackLink" ' + + 'title="' + self.footnote_title + '">' + + self.footnote_return_symbol + + '</a>') % (id, i+1) + except TypeError: + log.debug("Footnote error. `footnote_title` " + "must include parameter. Using defaults.") + backlink = ('<a href="#fnref-%s" ' + 'class="footnoteBackLink" ' + 'title="Jump back to footnote %d in the text.">' + '↩</a>' % (id, i+1)) + + if footer[-1].endswith("</p>"): + footer[-1] = footer[-1][:-len("</p>")] \ + + ' ' + backlink + "</p>" + else: + footer.append("\n<p>%s</p>" % backlink) + footer.append('</li>') + footer.append('</ol>') + footer.append('</div>') + return text + '\n\n' + '\n'.join(footer) + else: + return text + + _naked_lt_re = re.compile(r'<(?![a-z/?\$!])', re.I) + _naked_gt_re = re.compile(r'''(?<![a-z0-9?!/'"-])>''', re.I) + + def _encode_amps_and_angles(self, text): + # Smart processing for ampersands and angle brackets that need + # to be encoded. + text = _AMPERSAND_RE.sub('&', text) + + # Encode naked <'s + text = self._naked_lt_re.sub('<', text) + + # Encode naked >'s + # Note: Other markdown implementations (e.g. Markdown.pl, PHP + # Markdown) don't do this. + text = self._naked_gt_re.sub('>', text) + return text + + _incomplete_tags_re = re.compile(r"<(!--|/?\w+?(?!\w)\s*?.+?[\s/]+?)") + + def _encode_incomplete_tags(self, text): + if self.safe_mode not in ("replace", "escape"): + return text + + if text.endswith(">"): + return text # this is not an incomplete tag, this is a link in the form <http://x.y.z> + + def incomplete_tags_sub(match): + return match.group().replace('<', '<') + + return self._incomplete_tags_re.sub(incomplete_tags_sub, text) + + def _encode_backslash_escapes(self, text): + for ch, escape in list(self._escape_table.items()): + text = text.replace("\\"+ch, escape) + return text + + _auto_link_re = re.compile(r'<((https?|ftp):[^\'">\s]+)>', re.I) + def _auto_link_sub(self, match): + g1 = match.group(1) + return '<a href="%s">%s</a>' % (self._protect_url(g1), g1) + + _auto_email_link_re = re.compile(r""" + < + (?:mailto:)? + ( + [-.\w]+ + \@ + [-\w]+(\.[-\w]+)*\.[a-z]+ + ) + > + """, re.I | re.X | re.U) + def _auto_email_link_sub(self, match): + return self._encode_email_address( + self._unescape_special_chars(match.group(1))) + + def _do_auto_links(self, text): + text = self._auto_link_re.sub(self._auto_link_sub, text) + text = self._auto_email_link_re.sub(self._auto_email_link_sub, text) + return text + + def _encode_email_address(self, addr): + # Input: an email address, e.g. "foo@example.com" + # + # Output: the email address as a mailto link, with each character + # of the address encoded as either a decimal or hex entity, in + # the hopes of foiling most address harvesting spam bots. E.g.: + # + # <a href="mailto:foo@e + # xample.com">foo + # @example.com</a> + # + # Based on a filter by Matthew Wickline, posted to the BBEdit-Talk + # mailing list: <http://tinyurl.com/yu7ue> + chars = [_xml_encode_email_char_at_random(ch) + for ch in "mailto:" + addr] + # Strip the mailto: from the visible part. + addr = '<a href="%s">%s</a>' \ + % (''.join(chars), ''.join(chars[7:])) + return addr + + def _unescape_special_chars(self, text): + # Swap back in all the special characters we've hidden. + hashmap = tuple(self._escape_table.items()) + tuple(self._code_table.items()) + # html_blocks table is in format {hash: item} compared to usual {item: hash} + hashmap += tuple(tuple(reversed(i)) for i in self.html_blocks.items()) + while True: + orig_text = text + for ch, hash in hashmap: + text = text.replace(hash, ch) + if text == orig_text: + break + return text + + def _outdent(self, text): + # Remove one level of line-leading tabs or spaces + return self._outdent_re.sub('', text) + + @staticmethod + def _uniform_outdent(text, min_outdent=None, max_outdent=None): + ''' + Removes the smallest common leading indentation from each (non empty) + line of `text` and returns said indent along with the outdented text. + + Args: + min_outdent: make sure the smallest common whitespace is at least this size + max_outdent: the maximum amount a line can be outdented by + ''' + + # find the leading whitespace for every line + whitespace = [ + re.findall(r'^[ \t]*', line)[0] if line else None + for line in text.splitlines() + ] + whitespace_not_empty = [i for i in whitespace if i is not None] + + # if no whitespace detected (ie: no lines in code block, issue #505) + if not whitespace_not_empty: + return '', text + + # get minimum common whitespace + outdent = min(whitespace_not_empty) + # adjust min common ws to be within bounds + if min_outdent is not None: + outdent = min([i for i in whitespace_not_empty if i >= min_outdent] or [min_outdent]) + if max_outdent is not None: + outdent = min(outdent, max_outdent) + + outdented = [] + for line_ws, line in zip(whitespace, text.splitlines(True)): + if line.startswith(outdent): + # if line starts with smallest common ws, dedent it + outdented.append(line.replace(outdent, '', 1)) + elif line_ws is not None and line_ws < outdent: + # if less indented than min common whitespace then outdent as much as possible + outdented.append(line.replace(line_ws, '', 1)) + else: + outdented.append(line) + + return outdent, ''.join(outdented) + + @staticmethod + def _uniform_indent(text, indent, include_empty_lines=False, indent_empty_lines=False): + ''' + Uniformly indent a block of text by a fixed amount + + Args: + text: the text to indent + indent: a string containing the indent to apply + include_empty_lines: don't remove whitespace only lines + indent_empty_lines: indent whitespace only lines with the rest of the text + ''' + blocks = [] + for line in text.splitlines(True): + if line.strip() or indent_empty_lines: + blocks.append(indent + line) + elif include_empty_lines: + blocks.append(line) + else: + blocks.append('') + return ''.join(blocks) + + @staticmethod + def _match_overlaps_substr(text, match, substr): + ''' + Checks if a regex match overlaps with a substring in the given text. + ''' + for instance in re.finditer(re.escape(substr), text): + start, end = instance.span() + if start <= match.start() <= end: + return True + if start <= match.end() <= end: + return True + return False + + +class MarkdownWithExtras(Markdown): + """A markdowner class that enables most extras: + + - footnotes + - fenced-code-blocks (only highlights code if 'pygments' Python module on path) + + These are not included: + - pyshell (specific to Python-related documenting) + - code-friendly (because it *disables* part of the syntax) + - link-patterns (because you need to specify some actual + link-patterns anyway) + """ + extras = ["footnotes", "fenced-code-blocks"] + + +# ---------------------------------------------------------- +# Extras +# ---------------------------------------------------------- + +# Base classes +# ---------------------------------------------------------- + +class Extra(ABC): + _registry = {} + _exec_order: Dict[Stage, Tuple[List['Extra'], List['Extra']]] = {} + + name: str + ''' + An identifiable name that users can use to invoke the extra + in the Markdown class + ''' + order: Tuple[Iterable[Union[Stage, 'Extra']], Iterable[Union[Stage, 'Extra']]] + ''' + Tuple of two iterables containing the stages/extras this extra will run before and + after, respectively + ''' + + def __init__(self, md: Markdown, options: Optional[dict]): + ''' + Args: + md: An instance of `Markdown` + options: a dict of settings to alter the extra's behaviour + ''' + self.md = md + self.options = options if options is not None else {} + + @classmethod + def deregister(cls): + ''' + Removes the class from the extras registry and unsets its execution order. + ''' + if cls.name in cls._registry: + del cls._registry[cls.name] + + for exec_order in Extra._exec_order.values(): + # find everywhere this extra is mentioned and remove it + for section in exec_order: + while cls in section: + section.remove(cls) + + @classmethod + def register(cls): + ''' + Registers the class for use with `Markdown` and calculates its execution order based on + the `order` class attribute. + ''' + cls._registry[cls.name] = cls + + for index, item in enumerate((*cls.order[0], *cls.order[1])): + before = index < len(cls.order[0]) + if not isinstance(item, Stage) and issubclass(item, Extra): + # eg: FencedCodeBlocks + for exec_orders in Extra._exec_order.values(): + # insert this extra everywhere the other one is mentioned + for section in exec_orders: + if item in section: + to_index = section.index(item) + if not before: + to_index += 1 + section.insert(to_index, cls) + else: + # eg: Stage.PREPROCESS + Extra._exec_order.setdefault(item, ([], [])) + if cls in Extra._exec_order[item][0 if before else 1]: + # extra is already runnig after this stage. Don't duplicate that effort + continue + if before: + Extra._exec_order[item][0].insert(0, cls) + else: + Extra._exec_order[item][1].append(cls) + + @abstractmethod + def run(self, text: str) -> str: + ''' + Run the extra against the given text. + + Returns: + The new text after being modified by the extra + ''' + ... + + def test(self, text: str) -> bool: + ''' + Check a section of markdown to see if this extra should be run upon it. + The default implementation will always return True but it's recommended to override + this behaviour to improve performance. + ''' + return True + + +class ItalicAndBoldProcessor(Extra): + ''' + An ABC that provides hooks for dealing with italics and bold syntax. + This class is set to trigger both before AND after the italics and bold stage. + This allows any child classes to intercept instances of bold or italic syntax and + change the output or hash it to prevent it from being processed. + + After the I&B stage any hashes in the `hash_tables` instance variable are replaced. + ''' + name = 'italic-and-bold-processor' + order = (Stage.ITALIC_AND_BOLD,), (Stage.ITALIC_AND_BOLD,) + + strong_re = Markdown._strong_re + em_re = Markdown._em_re + + def __init__(self, md: Markdown, options: dict): + super().__init__(md, options) + self.hash_table = {} + + def run(self, text): + if self.md.order < Stage.ITALIC_AND_BOLD: + text = self.strong_re.sub(self.sub, text) + text = self.em_re.sub(self.sub, text) + else: + # put any hashed values back + for key, substr in self.hash_table.items(): + text = text.replace(key, substr) + return text + + @abstractmethod + def sub(self, match): + # do nothing. Let `Markdown._do_italics_and_bold` do its thing later + return match.string[match.start(): match.end()] + + def sub_hash(self, match): + substr = match.string[match.start(): match.end()] + key = _hash_text(substr) + self.hash_table[key] = substr + return key + + def test(self, text): + if self.md.order < Stage.ITALIC_AND_BOLD: + return '*' in text or '_' in text + return self.hash_table and re.search(r'md5-[0-9a-z]{32}', text) + +# User facing extras +# ---------------------------------------------------------- + + +class Admonitions(Extra): + ''' + Enable parsing of RST admonitions + ''' + + name = 'admonitions' + order = (Stage.BLOCK_GAMUT, Stage.LINK_DEFS), () + + admonitions = r'admonition|attention|caution|danger|error|hint|important|note|tip|warning' + + admonitions_re = re.compile(r''' + ^(\ *)\.\.\ (%s)::\ * # $1 leading indent, $2 the admonition + (.*)? # $3 admonition title + ((?:\s*\n\1\ {3,}.*)+?) # $4 admonition body (required) + (?=\s*(?:\Z|\n{4,}|\n\1?\ {0,2}\S)) # until EOF, 3 blank lines or something less indented + ''' % admonitions, + re.IGNORECASE | re.MULTILINE | re.VERBOSE + ) + + def test(self, text): + return self.admonitions_re.search(text) is not None + + def sub(self, match): + lead_indent, admonition_name, title, body = match.groups() + + admonition_type = '<strong>%s</strong>' % admonition_name + + # figure out the class names to assign the block + if admonition_name.lower() == 'admonition': + admonition_class = 'admonition' + else: + admonition_class = 'admonition %s' % admonition_name.lower() + + # titles are generally optional + if title: + title = '<em>%s</em>' % title + + # process the admonition body like regular markdown + body = self.md._run_block_gamut("\n%s\n" % self.md._uniform_outdent(body)[1]) + + # indent the body before placing inside the aside block + admonition = self.md._uniform_indent( + '%s\n%s\n\n%s\n' % (admonition_type, title, body), + self.md.tab, False + ) + # wrap it in an aside + admonition = '<aside class="%s">\n%s</aside>' % (admonition_class, admonition) + # now indent the whole admonition back to where it started + return self.md._uniform_indent(admonition, lead_indent, False) + + def run(self, text): + return self.admonitions_re.sub(self.sub, text) + + +class Breaks(Extra): + name = 'breaks' + order = (), (Stage.ITALIC_AND_BOLD,) + + def run(self, text): + on_backslash = self.options.get('on_backslash', False) + on_newline = self.options.get('on_newline', False) + + if on_backslash and on_newline: + pattern = r' *\\?' + elif on_backslash: + pattern = r'(?: *\\| {2,})' + elif on_newline: + pattern = r' *' + else: + pattern = r' {2,}' + + break_tag = "<br%s\n" % self.md.empty_element_suffix + text = re.sub(pattern + r"\n(?!\<(?:\/?(ul|ol|li))\>)", break_tag, text) + + return text + + +class CodeFriendly(ItalicAndBoldProcessor): + ''' + Disable _ and __ for em and strong. + ''' + name = 'code-friendly' + + def sub(self, match): + syntax = match.group(1) + if '_' not in syntax: + return super().sub(match) + text = match.string[match.start(): match.end()] + key = _hash_text(text) + self.hash_table[key] = text + return key + + +class FencedCodeBlocks(Extra): + ''' + Allows a code block to not have to be indented + by fencing it with '```' on a line before and after. Based on + <http://github.github.com/github-flavored-markdown/> with support for + syntax highlighting. + ''' + + name = 'fenced-code-blocks' + order = (Stage.LINK_DEFS, Stage.BLOCK_GAMUT), (Stage.PREPROCESS,) + + fenced_code_block_re = re.compile(r''' + (?:\n+|\A\n?|(?<=\n)) + (^[ \t]*`{3,})\s{0,99}?([\w+-]+)?\s{0,99}?\n # $1 = opening fence (captured for back-referencing), $2 = optional lang + (.*?) # $3 = code block content + \1[ \t]*\n # closing fence + ''', re.M | re.X | re.S) + + def test(self, text): + if '```' not in text: + return False + if self.md.stage == Stage.PREPROCESS and not self.md.safe_mode: + return True + if self.md.stage == Stage.LINK_DEFS and self.md.safe_mode: + return True + return self.md.stage == Stage.BLOCK_GAMUT + + def _code_block_with_lexer_sub(self, codeblock, leading_indent, lexer): + formatter_opts = self.md.extras['fenced-code-blocks'] or {} + + def unhash_code(codeblock): + for key, sanitized in list(self.md.html_spans.items()): + codeblock = codeblock.replace(key, sanitized) + replacements = [ + ("&", "&"), + ("<", "<"), + (">", ">") + ] + for old, new in replacements: + codeblock = codeblock.replace(old, new) + return codeblock + # remove leading indent from code block + _, codeblock = self.md._uniform_outdent(codeblock, max_outdent=leading_indent) + + codeblock = unhash_code(codeblock) + colored = self.md._color_with_pygments(codeblock, lexer, + **formatter_opts) + + # add back the indent to all lines + return "\n%s\n" % self.md._uniform_indent(colored, leading_indent, True) + + def tags(self, lexer_name) -> tuple: + ''' + Returns the tags that the encoded code block will be wrapped in, based + upon the lexer name. + + This function can be overridden by subclasses to piggy-back off of the + fenced code blocks syntax (see `Mermaid` extra). + + Returns: + The opening and closing tags, as strings within a tuple + ''' + pre_class = self.md._html_class_str_from_tag('pre') + if "highlightjs-lang" in self.md.extras and lexer_name: + code_class = ' class="%s language-%s"' % (lexer_name, lexer_name) + else: + code_class = self.md._html_class_str_from_tag('code') + return ('<pre%s><code%s>' % (pre_class, code_class), '</code></pre>') + + def sub(self, match): + lexer_name = match.group(2) + codeblock = match.group(3) + codeblock = codeblock[:-1] # drop one trailing newline + + # Use pygments only if not using the highlightjs-lang extra + if lexer_name and "highlightjs-lang" not in self.md.extras: + lexer = self.md._get_pygments_lexer(lexer_name) + if lexer: + leading_indent = ' '*(len(match.group(1)) - len(match.group(1).lstrip())) + return self._code_block_with_lexer_sub(codeblock, leading_indent, lexer) + + # Fenced code blocks need to be outdented before encoding, and then reapplied + leading_indent = ' ' * (len(match.group(1)) - len(match.group(1).lstrip())) + if codeblock: + # only run the codeblock through the outdenter if not empty + leading_indent, codeblock = self.md._uniform_outdent(codeblock, max_outdent=leading_indent) + + codeblock = self.md._encode_code(codeblock) + + tags = self.tags(lexer_name) + + return "\n%s%s%s\n%s\n" % (leading_indent, tags[0], codeblock, tags[1]) + + def run(self, text): + return self.fenced_code_block_re.sub(self.sub, text) + +class Latex(Extra): + ''' + Convert $ and $$ to <math> and </math> tags for inline and block math. + ''' + name = 'latex' + order = (Stage.HASH_HTML,), () + + _single_dollar_re = re.compile(r'(?<!\$)\$(?!\$)(.*?)\$') + _double_dollar_re = re.compile(r'\$\$(.*?)\$\$', re.DOTALL) + + _pre_code_block_re = re.compile(r"<pre>(.*?)</pre>", re.DOTALL) + + converter = None + code_blocks = {} + + def _convert_single_match(self, match): + return self.converter.convert(match.group(1)) + + def _convert_double_match(self, match): + return self.converter.convert(match.group(1).replace(r"\n", ''), display="block") + + def code_placeholder(self, match): + #print("found match:", match, match.group(0), match.group(1)) + placeholder = f"<!--CODE_BLOCK_{len(self.code_blocks)}-->" + self.code_blocks[placeholder] = match.group(0) + return placeholder + + def run(self, text): + try: + import latex2mathml.converter + self.converter = latex2mathml.converter + except ImportError: + raise ImportError('The "latex" extra requires the "latex2mathml" package to be installed.') + + text = self._pre_code_block_re.sub(self.code_placeholder, text) + + #print("Temp Text", text) + + text = self._single_dollar_re.sub(self._convert_single_match, text) + text = self._double_dollar_re.sub(self._convert_double_match, text) + + for placeholder, code_block in self.code_blocks.items(): + text = text.replace(placeholder, code_block) + + return text + + + + + +class LinkPatterns(Extra): + ''' + Auto-link given regex patterns in text (e.g. bug number + references, revision number references). + ''' + name = 'link-patterns' + order = (Stage.LINKS,), () + + _basic_link_re = re.compile(r'!?\[.*?\]\(.*?\)') + + def run(self, text): + link_from_hash = {} + for regex, repl in self.options: + replacements = [] + for match in regex.finditer(text): + if any(self.md._match_overlaps_substr(text, match, h) for h in link_from_hash): + continue + + if hasattr(repl, "__call__"): + href = repl(match) + else: + href = match.expand(repl) + replacements.append((match.span(), href)) + for (start, end), href in reversed(replacements): + + # Do not match against links inside brackets. + if text[start - 1:start] == '[' and text[end:end + 1] == ']': + continue + + # Do not match against links in the standard markdown syntax. + if text[start - 2:start] == '](' or text[end:end + 2] == '")': + continue + + # Do not match against links which are escaped. + if text[start - 3:start] == '"""' and text[end:end + 3] == '"""': + text = text[:start - 3] + text[start:end] + text[end + 3:] + continue + + # search the text for anything that looks like a link + is_inside_link = False + for link_re in (self.md._auto_link_re, self._basic_link_re): + for match in link_re.finditer(text): + if any((r[0] <= start and end <= r[1]) for r in match.regs): + # if the link pattern start and end pos is within the bounds of + # something that looks like a link, then don't process it + is_inside_link = True + break + else: + continue + break + + if is_inside_link: + continue + + escaped_href = ( + href.replace('"', '"') # b/c of attr quote + # To avoid markdown <em> and <strong>: + .replace('*', self.md._escape_table['*']) + .replace('_', self.md._escape_table['_'])) + link = '<a href="%s">%s</a>' % (escaped_href, text[start:end]) + hash = _hash_text(link) + link_from_hash[hash] = link + text = text[:start] + hash + text[end:] + for hash, link in list(link_from_hash.items()): + text = text.replace(hash, link) + return text + + def test(self, text): + return True + + +class MarkdownInHTML(Extra): + ''' + Allow the use of `markdown="1"` in a block HTML tag to + have markdown processing be done on its contents. Similar to + <http://michelf.com/projects/php-markdown/extra/#markdown-attr> but with + some limitations. + ''' + name = 'markdown-in-html' + order = (), (Stage.HASH_HTML,) + + def run(self, text): + def callback(block): + indent, block = self.md._uniform_outdent(block) + block = self.md._hash_html_block_sub(block) + block = self.md._uniform_indent(block, indent, include_empty_lines=True, indent_empty_lines=False) + return block + + return self.md._strict_tag_block_sub(text, self.md._block_tags_a, callback, True) + + def test(self, text): + return True + + +class Mermaid(FencedCodeBlocks): + name = 'mermaid' + order = (FencedCodeBlocks,), () + + def tags(self, lexer_name): + if lexer_name == 'mermaid': + return ('<pre class="mermaid-pre"><div class="mermaid">', '</div></pre>') + return super().tags(lexer_name) + + +class MiddleWordEm(ItalicAndBoldProcessor): + ''' + Allows or disallows emphasis syntax in the middle of words, + defaulting to allow. Disabling this means that `this_text_here` will not be + converted to `this<em>text</em>here`. + ''' + name = 'middle-word-em' + order = (CodeFriendly,), (Stage.ITALIC_AND_BOLD,) + + def __init__(self, md: Markdown, options: Union[dict, bool]): + ''' + Args: + md: the markdown instance + options: can be bool for backwards compatibility but will be converted to a dict + in the constructor. All options are: + - allowed (bool): whether to allow emphasis in the middle of a word. + If `options` is a bool it will be placed under this key. + ''' + if isinstance(options, bool): + options = {'allowed': options} + options.setdefault('allowed', True) + super().__init__(md, options) + + self.liberal_em_re = self.em_re + if not options['allowed']: + self.em_re = re.compile(r'(?<=\b)%s(?=\b)' % self.liberal_em_re.pattern, self.liberal_em_re.flags) + + def run(self, text): + # run strong and whatnot first + # this also will process all strict ems + text = super().run(text) + if self.md.order < self.md.stage: + # hash all non-valid ems + text = self.liberal_em_re.sub(self.sub_hash, text) + return text + + def sub(self, match): + syntax = match.group(1) + if len(syntax) != 1: + # strong syntax + return super().sub(match) + return '<em>%s</em>' % match.group(2) + + def sub_hash(self, match): + text = match.string[match.start(): match.end()] + key = _hash_text(text) + self.hash_table[key] = text + return key + + +class Numbering(Extra): + ''' + Support of generic counters. Non standard extension to + allow sequential numbering of figures, tables, equations, exhibits etc. + ''' + + name = 'numbering' + order = (Stage.LINK_DEFS,), () + + def test(self, text): + return True + + def run(self, text): + # First pass to define all the references + regex_defns = re.compile(r''' + \[\#(\w+) # the counter. Open square plus hash plus a word \1 + ([^@]*) # Some optional characters, that aren't an @. \2 + @(\w+) # the id. Should this be normed? \3 + ([^\]]*)\] # The rest of the text up to the terminating ] \4 + ''', re.VERBOSE) + regex_subs = re.compile(r"\[@(\w+)\s*\]") # [@ref_id] + counters = {} + references = {} + replacements = [] + definition_html = '<figcaption class="{}" id="counter-ref-{}">{}{}{}</figcaption>' + reference_html = '<a class="{}" href="#counter-ref-{}">{}</a>' + for match in regex_defns.finditer(text): + # We must have four match groups otherwise this isn't a numbering reference + if len(match.groups()) != 4: + continue + counter = match.group(1) + text_before = match.group(2).strip() + ref_id = match.group(3) + text_after = match.group(4) + number = counters.get(counter, 1) + references[ref_id] = (number, counter) + replacements.append((match.start(0), + definition_html.format(counter, + ref_id, + text_before, + number, + text_after), + match.end(0))) + counters[counter] = number + 1 + for repl in reversed(replacements): + text = text[:repl[0]] + repl[1] + text[repl[2]:] + + # Second pass to replace the references with the right + # value of the counter + # Fwiw, it's vaguely annoying to have to turn the iterator into + # a list and then reverse it but I can't think of a better thing to do. + for match in reversed(list(regex_subs.finditer(text))): + number, counter = references.get(match.group(1), (None, None)) + if number is not None: + repl = reference_html.format(counter, + match.group(1), + number) + else: + repl = reference_html.format(match.group(1), + 'countererror', + '?' + match.group(1) + '?') + if "smarty-pants" in self.md.extras: + repl = repl.replace('"', self.md._escape_table['"']) + + text = text[:match.start()] + repl + text[match.end():] + return text + + +class PyShell(Extra): + ''' + Treats unindented Python interactive shell sessions as <code> + blocks. + ''' + + name = 'pyshell' + order = (), (Stage.LISTS,) + + def test(self, text): + return ">>>" in text + + def sub(self, match): + if "fenced-code-blocks" in self.md.extras: + dedented = _dedent(match.group(0)) + return self.md.extra_classes['fenced-code-blocks'].run("```pycon\n" + dedented + "```\n") + + lines = match.group(0).splitlines(0) + _dedentlines(lines) + indent = ' ' * self.md.tab_width + s = ('\n' # separate from possible cuddled paragraph + + indent + ('\n'+indent).join(lines) + + '\n') + return s + + def run(self, text): + less_than_tab = self.md.tab_width - 1 + _pyshell_block_re = re.compile(r""" + ^([ ]{0,%d})>>>[ ].*\n # first line + ^(\1[^\S\n]*\S.*\n)* # any number of subsequent lines with at least one character + (?=^\1?\n|\Z) # ends with a blank line or end of document + """ % less_than_tab, re.M | re.X) + + return _pyshell_block_re.sub(self.sub, text) + + +class SmartyPants(Extra): + ''' + Replaces ' and " with curly quotation marks or curly + apostrophes. Replaces --, ---, ..., and . . . with en dashes, em dashes, + and ellipses. + ''' + name = 'smarty-pants' + order = (), (Stage.SPAN_GAMUT,) + + _opening_single_quote_re = re.compile(r"(?<!\S)'(?=\S)") + _opening_double_quote_re = re.compile(r'(?<!\S)"(?=\S)') + _closing_single_quote_re = re.compile(r"(?<=\S)'") + _closing_double_quote_re = re.compile(r'(?<=\S)"(?=(\s|,|;|\.|\?|!|$))') + # "smarty-pants" extra: Very liberal in interpreting a single prime as an + # apostrophe; e.g. ignores the fact that "round", "bout", "twer", and + # "twixt" can be written without an initial apostrophe. This is fine because + # using scare quotes (single quotation marks) is rare. + _apostrophe_year_re = re.compile(r"'(\d\d)(?=(\s|,|;|\.|\?|!|$))") + _contractions = ["tis", "twas", "twer", "neath", "o", "n", + "round", "bout", "twixt", "nuff", "fraid", "sup"] + + + def contractions(self, text): + text = self._apostrophe_year_re.sub(r"’\1", text) + for c in self._contractions: + text = text.replace("'%s" % c, "’%s" % c) + text = text.replace("'%s" % c.capitalize(), + "’%s" % c.capitalize()) + return text + + def run(self, text): + """Fancifies 'single quotes', "double quotes", and apostrophes. + Converts --, ---, and ... into en dashes, em dashes, and ellipses. + + Inspiration is: <http://daringfireball.net/projects/smartypants/> + See "test/tm-cases/smarty_pants.text" for a full discussion of the + support here and + <http://code.google.com/p/python-markdown2/issues/detail?id=42> for a + discussion of some diversion from the original SmartyPants. + """ + if "'" in text: # guard for perf + text = self.contractions(text) + text = self._opening_single_quote_re.sub("‘", text) + text = self._closing_single_quote_re.sub("’", text) + + if '"' in text: # guard for perf + text = self._opening_double_quote_re.sub("“", text) + text = self._closing_double_quote_re.sub("”", text) + + text = text.replace("---", "—") + text = text.replace("--", "–") + text = text.replace("...", "…") + text = text.replace(" . . . ", "…") + text = text.replace(". . .", "…") + + # TODO: Temporary hack to fix https://github.com/trentm/python-markdown2/issues/150 + if "footnotes" in self.md.extras and "footnote-ref" in text: + # Quotes in the footnote back ref get converted to "smart" quotes + # Change them back here to ensure they work. + text = text.replace('class="footnote-ref”', 'class="footnote-ref"') + + return text + + def test(self, text): + return "'" in text or '"' in text + + +class Strike(Extra): + ''' + Text inside of double tilde is ~~strikethrough~~ + ''' + name = 'strike' + order = (Stage.ITALIC_AND_BOLD,), () + + _strike_re = re.compile(r"~~(?=\S)(.+?)(?<=\S)~~", re.S) + + def run(self, text): + return self._strike_re.sub(r"<s>\1</s>", text) + + def test(self, text): + return '~~' in text + + +class Tables(Extra): + ''' + Tables using the same format as GFM + <https://help.github.com/articles/github-flavored-markdown#tables> and + PHP-Markdown Extra <https://michelf.ca/projects/php-markdown/extra/#table>. + ''' + name = 'tables' + order = (), (Stage.LISTS,) + + def run(self, text): + """Copying PHP-Markdown and GFM table syntax. Some regex borrowed from + https://github.com/michelf/php-markdown/blob/lib/Michelf/Markdown.php#L2538 + """ + less_than_tab = self.md.tab_width - 1 + table_re = re.compile(r''' + (?:(?<=\n)|\A\n?) # leading blank line + + ^[ ]{0,%d} # allowed whitespace + (.*[|].*)[ ]*\n # $1: header row (at least one pipe) + + ^[ ]{0,%d} # allowed whitespace + ( # $2: underline row + # underline row with leading bar + (?: \|\ *:?-+:?\ * )+ \|? \s?[ ]*\n + | + # or, underline row without leading bar + (?: \ *:?-+:?\ *\| )+ (?: \ *:?-+:?\ * )? \s?[ ]*\n + ) + + ( # $3: data rows + (?: + ^[ ]{0,%d}(?!\ ) # ensure line begins with 0 to less_than_tab spaces + .*\|.*[ ]*\n + )+ + ) + ''' % (less_than_tab, less_than_tab, less_than_tab), re.M | re.X) + return table_re.sub(self.sub, text) + + def sub(self, match): + trim_space_re = '^[ \t\n]+|[ \t\n]+$' + trim_bar_re = r'^\||\|$' + split_bar_re = r'^\||(?<![\`\\])\|' + escape_bar_re = r'\\\|' + + head, underline, body = match.groups() + + # Determine aligns for columns. + cols = [re.sub(escape_bar_re, '|', cell.strip()) for cell in re.split(split_bar_re, re.sub(trim_bar_re, "", re.sub(trim_space_re, "", underline)))] + align_from_col_idx = {} + for col_idx, col in enumerate(cols): + if col[0] == ':' and col[-1] == ':': + align_from_col_idx[col_idx] = ' style="text-align:center;"' + elif col[0] == ':': + align_from_col_idx[col_idx] = ' style="text-align:left;"' + elif col[-1] == ':': + align_from_col_idx[col_idx] = ' style="text-align:right;"' + + # thead + hlines = ['<table%s>' % self.md._html_class_str_from_tag('table'), '<thead%s>' % self.md._html_class_str_from_tag('thead'), '<tr>'] + cols = [re.sub(escape_bar_re, '|', cell.strip()) for cell in re.split(split_bar_re, re.sub(trim_bar_re, "", re.sub(trim_space_re, "", head)))] + for col_idx, col in enumerate(cols): + hlines.append(' <th%s>%s</th>' % ( + align_from_col_idx.get(col_idx, ''), + self.md._run_span_gamut(col) + )) + hlines.append('</tr>') + hlines.append('</thead>') + + # tbody + hlines.append('<tbody>') + for line in body.strip('\n').split('\n'): + hlines.append('<tr>') + cols = [re.sub(escape_bar_re, '|', cell.strip()) for cell in re.split(split_bar_re, re.sub(trim_bar_re, "", re.sub(trim_space_re, "", line)))] + for col_idx, col in enumerate(cols): + hlines.append(' <td%s>%s</td>' % ( + align_from_col_idx.get(col_idx, ''), + self.md._run_span_gamut(col) + )) + hlines.append('</tr>') + hlines.append('</tbody>') + hlines.append('</table>') + + return '\n'.join(hlines) + '\n' + + def test(self, text): + return True + + +class TelegramSpoiler(Extra): + name = 'tg-spoiler' + order = (), (Stage.ITALIC_AND_BOLD,) + + _tg_spoiler_re = re.compile(r"\|\|\s?(.+?)\s?\|\|", re.S) + + def run(self, text): + return self._tg_spoiler_re.sub(r"<tg-spoiler>\1</tg-spoiler>", text) + + def test(self, text): + return '||' in text + + +class Underline(Extra): + ''' + Text inside of double dash is --underlined--. + ''' + name = 'underline' + order = (Stage.ITALIC_AND_BOLD,), () + + _underline_re = re.compile(r"(?<!<!)--(?!>)(?=\S)(.+?)(?<=\S)(?<!<!)--(?!>)", re.S) + + def run(self, text): + return self._underline_re.sub(r"<u>\1</u>", text) + + def test(self, text): + return '--' in text + + +class Wavedrom(Extra): + ''' + Support for generating Wavedrom digital timing diagrams + ''' + name = 'wavedrom' + order = (Stage.CODE_BLOCKS, FencedCodeBlocks), () + + def test(self, text): + match = FencedCodeBlocks.fenced_code_block_re.search(text) + return match is None or match.group(2) == 'wavedrom' + + def sub(self, match): + # dedent the block for processing + lead_indent, waves = self.md._uniform_outdent(match.group(3)) + # default tags to wrap the wavedrom block in + open_tag, close_tag = '<script type="WaveDrom">\n', '</script>' + + # check if the user would prefer to have the SVG embedded directly + embed_svg = self.options.get('prefer_embed_svg', True) + + if embed_svg: + try: + import wavedrom + waves = wavedrom.render(waves).tostring() + open_tag, close_tag = '<div>', '\n</div>' + except ImportError: + pass + + # hash SVG to prevent <> chars being messed with + self.md._escape_table[waves] = _hash_text(waves) + + return self.md._uniform_indent( + '\n%s%s%s\n' % (open_tag, self.md._escape_table[waves], close_tag), + lead_indent, include_empty_lines=True + ) + + def run(self, text): + return FencedCodeBlocks.fenced_code_block_re.sub(self.sub, text) + + +class WikiTables(Extra): + ''' + Google Code Wiki-style tables. See + <http://code.google.com/p/support/wiki/WikiSyntax#Tables>. + ''' + name = 'wiki-tables' + order = (Tables,), () + + def run(self, text): + less_than_tab = self.md.tab_width - 1 + wiki_table_re = re.compile(r''' + (?:(?<=\n\n)|\A\n?) # leading blank line + ^([ ]{0,%d})\|\|.+?\|\|[ ]*\n # first line + (^\1\|\|.+?\|\|\n)* # any number of subsequent lines + ''' % less_than_tab, re.M | re.X) + return wiki_table_re.sub(self.sub, text) + + def sub(self, match): + ttext = match.group(0).strip() + rows = [] + for line in ttext.splitlines(0): + line = line.strip()[2:-2].strip() + row = [c.strip() for c in re.split(r'(?<!\\)\|\|', line)] + rows.append(row) + + hlines = [] + + def add_hline(line, indents=0): + hlines.append((self.md.tab * indents) + line) + + def format_cell(text): + return self.md._run_span_gamut(re.sub(r"^\s*~", "", cell).strip(" ")) + + add_hline('<table%s>' % self.md._html_class_str_from_tag('table')) + # Check if first cell of first row is a header cell. If so, assume the whole row is a header row. + if rows and rows[0] and re.match(r"^\s*~", rows[0][0]): + add_hline('<thead%s>' % self.md._html_class_str_from_tag('thead'), 1) + add_hline('<tr>', 2) + for cell in rows[0]: + add_hline("<th>{}</th>".format(format_cell(cell)), 3) + add_hline('</tr>', 2) + add_hline('</thead>', 1) + # Only one header row allowed. + rows = rows[1:] + # If no more rows, don't create a tbody. + if rows: + add_hline('<tbody>', 1) + for row in rows: + add_hline('<tr>', 2) + for cell in row: + add_hline('<td>{}</td>'.format(format_cell(cell)), 3) + add_hline('</tr>', 2) + add_hline('</tbody>', 1) + add_hline('</table>') + return '\n'.join(hlines) + '\n' + + def test(self, text): + return '||' in text + + +# Register extras +Admonitions.register() +Breaks.register() +CodeFriendly.register() +FencedCodeBlocks.register() +Latex.register() +LinkPatterns.register() +MarkdownInHTML.register() +MiddleWordEm.register() +Mermaid.register() +Numbering.register() +PyShell.register() +SmartyPants.register() +Strike.register() +Tables.register() +TelegramSpoiler.register() +Underline.register() +Wavedrom.register() +WikiTables.register() + + +# ---------------------------------------------------------- + + +# ---- internal support functions + + +def calculate_toc_html(toc): + """Return the HTML for the current TOC. + + This expects the `_toc` attribute to have been set on this instance. + """ + if toc is None: + return None + + def indent(): + return ' ' * (len(h_stack) - 1) + lines = [] + h_stack = [0] # stack of header-level numbers + for level, id, name in toc: + if level > h_stack[-1]: + lines.append("%s<ul>" % indent()) + h_stack.append(level) + elif level == h_stack[-1]: + lines[-1] += "</li>" + else: + while level < h_stack[-1]: + h_stack.pop() + if not lines[-1].endswith("</li>"): + lines[-1] += "</li>" + lines.append("%s</ul></li>" % indent()) + lines.append('%s<li><a href="#%s">%s</a>' % ( + indent(), id, name)) + while len(h_stack) > 1: + h_stack.pop() + if not lines[-1].endswith("</li>"): + lines[-1] += "</li>" + lines.append("%s</ul>" % indent()) + return '\n'.join(lines) + '\n' + + +class UnicodeWithAttrs(str): + """A subclass of unicode used for the return value of conversion to + possibly attach some attributes. E.g. the "toc_html" attribute when + the "toc" extra is used. + """ + metadata = None + toc_html = None + +## {{{ http://code.activestate.com/recipes/577257/ (r1) +_slugify_strip_re = re.compile(r'[^\w\s-]') +_slugify_hyphenate_re = re.compile(r'[-\s]+') +def _slugify(value): + """ + Normalizes string, converts to lowercase, removes non-alpha characters, + and converts spaces to hyphens. + + From Django's "django/template/defaultfilters.py". + """ + import unicodedata + value = unicodedata.normalize('NFKD', value).encode('utf-8', 'ignore').decode() + value = _slugify_strip_re.sub('', value).strip().lower() + return _slugify_hyphenate_re.sub('-', value) +## end of http://code.activestate.com/recipes/577257/ }}} + + +# From http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52549 +def _curry(*args, **kwargs): + function, args = args[0], args[1:] + def result(*rest, **kwrest): + combined = kwargs.copy() + combined.update(kwrest) + return function(*args + rest, **combined) + return result + + +# Recipe: regex_from_encoded_pattern (1.0) +def _regex_from_encoded_pattern(s): + """'foo' -> re.compile(re.escape('foo')) + '/foo/' -> re.compile('foo') + '/foo/i' -> re.compile('foo', re.I) + """ + if s.startswith('/') and s.rfind('/') != 0: + # Parse it: /PATTERN/FLAGS + idx = s.rfind('/') + _, flags_str = s[1:idx], s[idx+1:] + flag_from_char = { + "i": re.IGNORECASE, + "l": re.LOCALE, + "s": re.DOTALL, + "m": re.MULTILINE, + "u": re.UNICODE, + } + flags = 0 + for char in flags_str: + try: + flags |= flag_from_char[char] + except KeyError: + raise ValueError("unsupported regex flag: '%s' in '%s' " + "(must be one of '%s')" + % (char, s, ''.join(list(flag_from_char.keys())))) + return re.compile(s[1:idx], flags) + else: # not an encoded regex + return re.compile(re.escape(s)) + + +# Recipe: dedent (0.1.2) +def _dedentlines(lines, tabsize=8, skip_first_line=False): + """_dedentlines(lines, tabsize=8, skip_first_line=False) -> dedented lines + + "lines" is a list of lines to dedent. + "tabsize" is the tab width to use for indent width calculations. + "skip_first_line" is a boolean indicating if the first line should + be skipped for calculating the indent width and for dedenting. + This is sometimes useful for docstrings and similar. + + Same as dedent() except operates on a sequence of lines. Note: the + lines list is modified **in-place**. + """ + DEBUG = False + if DEBUG: + print("dedent: dedent(..., tabsize=%d, skip_first_line=%r)"\ + % (tabsize, skip_first_line)) + margin = None + for i, line in enumerate(lines): + if i == 0 and skip_first_line: continue + indent = 0 + for ch in line: + if ch == ' ': + indent += 1 + elif ch == '\t': + indent += tabsize - (indent % tabsize) + elif ch in '\r\n': + continue # skip all-whitespace lines + else: + break + else: + continue # skip all-whitespace lines + if DEBUG: print("dedent: indent=%d: %r" % (indent, line)) + if margin is None: + margin = indent + else: + margin = min(margin, indent) + if DEBUG: print("dedent: margin=%r" % margin) + + if margin is not None and margin > 0: + for i, line in enumerate(lines): + if i == 0 and skip_first_line: continue + removed = 0 + for j, ch in enumerate(line): + if ch == ' ': + removed += 1 + elif ch == '\t': + removed += tabsize - (removed % tabsize) + elif ch in '\r\n': + if DEBUG: print("dedent: %r: EOL -> strip up to EOL" % line) + lines[i] = lines[i][j:] + break + else: + raise ValueError("unexpected non-whitespace char %r in " + "line %r while removing %d-space margin" + % (ch, line, margin)) + if DEBUG: + print("dedent: %r: %r -> removed %d/%d"\ + % (line, ch, removed, margin)) + if removed == margin: + lines[i] = lines[i][j+1:] + break + elif removed > margin: + lines[i] = ' '*(removed-margin) + lines[i][j+1:] + break + else: + if removed: + lines[i] = lines[i][removed:] + return lines + + +def _dedent(text, tabsize=8, skip_first_line=False): + """_dedent(text, tabsize=8, skip_first_line=False) -> dedented text + + "text" is the text to dedent. + "tabsize" is the tab width to use for indent width calculations. + "skip_first_line" is a boolean indicating if the first line should + be skipped for calculating the indent width and for dedenting. + This is sometimes useful for docstrings and similar. + + textwrap.dedent(s), but don't expand tabs to spaces + """ + lines = text.splitlines(1) + _dedentlines(lines, tabsize=tabsize, skip_first_line=skip_first_line) + return ''.join(lines) + + +class _memoized(object): + """Decorator that caches a function's return value each time it is called. + If called later with the same arguments, the cached value is returned, and + not re-evaluated. + + http://wiki.python.org/moin/PythonDecoratorLibrary + """ + def __init__(self, func): + self.func = func + self.cache = {} + + def __call__(self, *args): + try: + return self.cache[args] + except KeyError: + self.cache[args] = value = self.func(*args) + return value + except TypeError: + # uncachable -- for instance, passing a list as an argument. + # Better to not cache than to blow up entirely. + return self.func(*args) + + def __repr__(self): + """Return the function's docstring.""" + return self.func.__doc__ + + +def _xml_oneliner_re_from_tab_width(tab_width): + """Standalone XML processing instruction regex.""" + return re.compile(r""" + (?: + (?<=\n\n) # Starting after a blank line + | # or + \A\n? # the beginning of the doc + ) + ( # save in $1 + [ ]{0,%d} + (?: + <\?\w+\b\s+.*?\?> # XML processing instruction + | + <\w+:\w+\b\s+.*?/> # namespaced single tag + ) + [ \t]* + (?=\n{2,}|\Z) # followed by a blank line or end of document + ) + """ % (tab_width - 1), re.X) +_xml_oneliner_re_from_tab_width = _memoized(_xml_oneliner_re_from_tab_width) + + +def _hr_tag_re_from_tab_width(tab_width): + return re.compile(r""" + (?: + (?<=\n\n) # Starting after a blank line + | # or + \A\n? # the beginning of the doc + ) + ( # save in \1 + [ ]{0,%d} + <(hr) # start tag = \2 + \b # word break + ([^<>])*? # + /?> # the matching end tag + [ \t]* + (?=\n{2,}|\Z) # followed by a blank line or end of document + ) + """ % (tab_width - 1), re.X) +_hr_tag_re_from_tab_width = _memoized(_hr_tag_re_from_tab_width) + + +def _xml_escape_attr(attr, skip_single_quote=True): + """Escape the given string for use in an HTML/XML tag attribute. + + By default this doesn't bother with escaping `'` to `'`, presuming that + the tag attribute is surrounded by double quotes. + """ + escaped = _AMPERSAND_RE.sub('&', attr) + + escaped = (attr + .replace('"', '"') + .replace('<', '<') + .replace('>', '>')) + if not skip_single_quote: + escaped = escaped.replace("'", "'") + return escaped + + +def _xml_encode_email_char_at_random(ch): + r = random() + # Roughly 10% raw, 45% hex, 45% dec. + # '@' *must* be encoded. I [John Gruber] insist. + # Issue 26: '_' must be encoded. + if r > 0.9 and ch not in "@_": + return ch + elif r < 0.45: + # The [1:] is to drop leading '0': 0x63 -> x63 + return '&#%s;' % hex(ord(ch))[1:] + else: + return '&#%s;' % ord(ch) + + +def _html_escape_url(attr, safe_mode=False, charset=None): + """ + Replace special characters that are potentially malicious in url string. + + Args: + charset: don't escape characters from this charset. Currently the only + exception is for '+' when charset=='base64' + """ + escaped = (attr + .replace('"', '"') + .replace('<', '<') + .replace('>', '>')) + if safe_mode: + if charset != 'base64': + escaped = escaped.replace('+', ' ') + escaped = escaped.replace("'", "'") + return escaped + + +# ---- mainline + +class _NoReflowFormatter(argparse.RawDescriptionHelpFormatter): + """An argparse formatter that does NOT reflow the description.""" + def format_description(self, description): + return description or "" + + +def _test(): + import doctest + doctest.testmod() + + +def main(argv=None): + if argv is None: + argv = sys.argv + if not logging.root.handlers: + logging.basicConfig() + + parser = argparse.ArgumentParser( + prog="markdown2", description=cmdln_desc, usage='%(prog)s [PATHS...]', + formatter_class=_NoReflowFormatter + ) + parser.add_argument('--version', action='version', + version='%(prog)s {version}'.format(version=__version__)) + parser.add_argument('paths', nargs='*', + help=( + 'optional list of files to convert.' + 'If none are given, stdin will be used' + )) + parser.add_argument("-v", "--verbose", dest="log_level", + action="store_const", const=logging.DEBUG, + help="more verbose output") + parser.add_argument("--encoding", + help="specify encoding of text content") + parser.add_argument("--html4tags", action="store_true", default=False, + help="use HTML 4 style for empty element tags") + parser.add_argument("-s", "--safe", metavar="MODE", dest="safe_mode", + help="sanitize literal HTML: 'escape' escapes " + "HTML meta chars, 'replace' replaces with an " + "[HTML_REMOVED] note") + parser.add_argument("-x", "--extras", action="append", + help="Turn on specific extra features (not part of " + "the core Markdown spec). See above.") + parser.add_argument("--use-file-vars", + help="Look for and use Emacs-style 'markdown-extras' " + "file var to turn on extras. See " + "<https://github.com/trentm/python-markdown2/wiki/Extras>") + parser.add_argument("--link-patterns-file", + help="path to a link pattern file") + parser.add_argument("--self-test", action="store_true", + help="run internal self-tests (some doctests)") + parser.add_argument("--compare", action="store_true", + help="run against Markdown.pl as well (for testing)") + parser.set_defaults(log_level=logging.INFO, compare=False, + encoding="utf-8", safe_mode=None, use_file_vars=False) + opts = parser.parse_args() + paths = opts.paths + log.setLevel(opts.log_level) + + if opts.self_test: + return _test() + + if opts.extras: + extras = {} + for s in opts.extras: + splitter = re.compile("[,;: ]+") + for e in splitter.split(s): + if '=' in e: + ename, earg = e.split('=', 1) + try: + earg = int(earg) + except ValueError: + pass + else: + ename, earg = e, None + extras[ename] = earg + else: + extras = None + + if opts.link_patterns_file: + link_patterns = [] + f = open(opts.link_patterns_file) + try: + for i, line in enumerate(f.readlines()): + if not line.strip(): continue + if line.lstrip().startswith("#"): continue + try: + pat, href = line.rstrip().rsplit(None, 1) + except ValueError: + raise MarkdownError("%s:%d: invalid link pattern line: %r" + % (opts.link_patterns_file, i+1, line)) + link_patterns.append( + (_regex_from_encoded_pattern(pat), href)) + finally: + f.close() + else: + link_patterns = None + + from os.path import abspath, dirname, exists, join + markdown_pl = join(dirname(dirname(abspath(__file__))), "test", + "Markdown.pl") + if not paths: + paths = ['-'] + for path in paths: + if path == '-': + text = sys.stdin.read() + else: + fp = codecs.open(path, 'r', opts.encoding) + text = fp.read() + fp.close() + if opts.compare: + from subprocess import PIPE, Popen + print("==== Markdown.pl ====") + p = Popen('perl %s' % markdown_pl, shell=True, stdin=PIPE, stdout=PIPE, close_fds=True) + p.stdin.write(text.encode('utf-8')) + p.stdin.close() + perl_html = p.stdout.read().decode('utf-8') + sys.stdout.write(perl_html) + print("==== markdown2.py ====") + html = markdown(text, + html4tags=opts.html4tags, + safe_mode=opts.safe_mode, + extras=extras, link_patterns=link_patterns, + use_file_vars=opts.use_file_vars, + cli=True) + sys.stdout.write(html) + if extras and "toc" in extras: + log.debug("toc_html: " + + str(html.toc_html.encode(sys.stdout.encoding or "utf-8", 'xmlcharrefreplace'))) + if opts.compare: + test_dir = join(dirname(dirname(abspath(__file__))), "test") + if exists(join(test_dir, "test_markdown2.py")): + sys.path.insert(0, test_dir) + from test_markdown2 import norm_html_from_html + norm_html = norm_html_from_html(html) + norm_perl_html = norm_html_from_html(perl_html) + else: + norm_html = html + norm_perl_html = perl_html + print("==== match? %r ====" % (norm_perl_html == norm_html)) + + +if __name__ == "__main__": + sys.exit(main(sys.argv)) diff --git a/poetry.lock b/poetry.lock index 12931b0..c4a1e3a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -163,15 +163,26 @@ MarkupSafe = ">=2.0" [package.extras] i18n = ["Babel (>=2.7)"] +[[package]] +name = "latex2mathml" +version = "3.77.0" +description = "Pure Python library for LaTeX to MathML conversion" +optional = false +python-versions = ">=3.8.1,<4.0.0" +files = [ + {file = "latex2mathml-3.77.0-py3-none-any.whl", hash = "sha256:5531e18a2a9eae7c24e257118b6a444cbba253cd27ff3e81f1bd6c41e88e786e"}, + {file = "latex2mathml-3.77.0.tar.gz", hash = "sha256:e2f501d1878f2e489c3f6f12786bef74c62f712d2770f7f3c837eb20a55d0a1e"}, +] + [[package]] name = "markdown2" -version = "2.4.12" +version = "2.4.13" description = "A fast and complete Python implementation of Markdown" optional = false python-versions = ">=3.5, <4" files = [ - {file = "markdown2-2.4.12-py2.py3-none-any.whl", hash = "sha256:98f47591006f0ace0644cbece03fed6f3845513286f6c6e9f8bcf6a575174e2c"}, - {file = "markdown2-2.4.12.tar.gz", hash = "sha256:1bc8692696954d597778e0e25713c14ca56d87992070dedd95c17eddaf709204"}, + {file = "markdown2-2.4.13-py2.py3-none-any.whl", hash = "sha256:855bde5cbcceb9beda7c80efdf7f406c23e6079172c497fcfce22fdce998e892"}, + {file = "markdown2-2.4.13.tar.gz", hash = "sha256:18ceb56590da77f2c22382e55be48c15b3c8f0c71d6398def387275e6c347a9f"}, ] [package.extras] @@ -443,4 +454,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "8e40b80581a332bddf013411192567bdd8a193f558b8b959030f9688cf92a3b6" +content-hash = "2b2d4d8564d95438217855fb88cf03ad1564c4ff900bdede9cd11ca5c175b265" diff --git a/pyproject.toml b/pyproject.toml index fc7a960..84abe8e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,7 @@ Pillow = "10.0.1" requests = "^2.31.0" certifi = "^2023.7.22" urllib3 = "^2.0.7" +latex2mathml = "^3.77.0" [tool.poetry.dev-dependencies] -- cgit v1.2.3 From b1f76ea37e6d8d6dc949ecc4899e3a1bc6d7ef65 Mon Sep 17 00:00:00 2001 From: Navan Chauhan <navanchauhan@gmail.com> Date: Wed, 27 Mar 2024 22:49:15 -0600 Subject: use new theme --- Makefile | 13 + sass/c-hyde.scss | 825 +++++++++++++++++++++++++++++++++++++++++++++++++ templates/base.html | 24 +- templates/index.html | 2 +- templates/post.html | 5 +- templates/sidebar.html | 17 + 6 files changed, 877 insertions(+), 9 deletions(-) create mode 100644 Makefile create mode 100644 sass/c-hyde.scss create mode 100644 templates/sidebar.html diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a67831f --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +# Makefile + + +scss: + sass sass/c-hyde.scss Resources/assets/c-hyde.css + +generate: + python3 generate_me.py + +all: scss generate + +clean: + rm -r docs/* diff --git a/sass/c-hyde.scss b/sass/c-hyde.scss new file mode 100644 index 0000000..26cd3b7 --- /dev/null +++ b/sass/c-hyde.scss @@ -0,0 +1,825 @@ +/* +Latex CSS +*/ + +@font-face { + font-family: 'Latin Modern'; + font-style: normal; + font-weight: normal; + font-display: swap; + src: url('/assets/fonts/LM-regular.woff2') format('woff2'), + url('/assets/fonts/LM-regular.woff') format('woff'), + url('/assets/fonts/LM-regular.ttf') format('truetype'); +} + +@font-face { + font-family: 'Latin Modern'; + font-style: italic; + font-weight: normal; + font-display: swap; + src: url('/assets/LM-italic.woff2') format('woff2'), + url('LM-italic.woff') format('woff'), + url('/assets/fonts/LM-italic.ttf') format('truetype'); +} + +@font-face { + font-family: 'Latin Modern'; + font-style: normal; + font-weight: bold; + font-display: swap; + src: url('/assets/fonts/LM-bold.woff2') format('woff2'), + url('/assets/fonts/LM-bold.woff') format('woff'), + url('/assets/fonts/LM-bold.ttf') format('truetype'); +} + +@font-face { + font-family: 'Latin Modern'; + font-style: italic; + font-weight: bold; + font-display: swap; + src: url('/assets/fonts/LM-bold-italic.woff2') format('woff2'), + url('/assets/fonts/LM-bold-italic.woff') format('woff'), + url('/assets/fonts/LM-bold-italic.ttf') format('truetype'); +} + +@font-face { + font-family: 'Libertinus'; + font-style: normal; + font-weight: normal; + font-display: swap; + src: url('/assets/fonts/Libertinus-regular.woff2') format('woff2'); +} + +@font-face { + font-family: 'Libertinus'; + font-style: italic; + font-weight: normal; + font-display: swap; + src: url('/assets/fonts/Libertinus-italic.woff2') format('woff2'); +} + +@font-face { + font-family: 'Libertinus'; + font-style: normal; + font-weight: bold; + font-display: swap; + src: url('/assets/fonts/Libertinus-bold.woff2') format('woff2'); +} + +@font-face { + font-family: 'Libertinus'; + font-style: italic; + font-weight: bold; + font-display: swap; + src: url('/assets/fonts/Libertinus-bold-italic.woff2') format('woff2'); +} + +@font-face { + font-family: 'Libertinus'; + font-style: normal; + font-weight: 600; + font-display: swap; + src: url('/assets/fonts/Libertinus-semibold.woff2') format('woff2'); +} + +@font-face { + font-family: 'Libertinus'; + font-style: italic; + font-weight: 600; + font-display: swap; + src: url('/assets/fonts/Libertinus-semibold-italic.woff2') format('woff2'); +} + + +/* +Port of @mdo's Hyde Theme by Zola + +MIT License + +Copyright (c) 2017 Vincent Prouillet + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + + +/* + * ___ + * /\_ \ + * _____ ___ ___\//\ \ __ + * /\ '__`\ / __`\ / __`\\ \ \ /'__`\ + * \ \ \_\ \/\ \_\ \/\ \_\ \\_\ \_/\ __/ + * \ \ ,__/\ \____/\ \____//\____\ \____\ + * \ \ \/ \/___/ \/___/ \/____/\/____/ + * \ \_\ + * \/_/ + * + * Designed, built, and released under MIT license by @mdo. Learn more at + * https://github.com/poole/poole. + */ + + +/* + * Contents + * + * Body resets + * Custom type + * Messages + * Container + * Masthead + * Posts and pages + * Footnotes + * Pagination + * Reverse layout + * Themes + */ + + +/* + * Body resets + * + * Update the foundational and global aspects of the page. + */ + +* { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +html, +body { + margin: 0; + padding: 0; +} + +html { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 16px; + line-height: 1.5; +} +@media (min-width: 38em) { + html { + font-size: 20px; + } +} + +body { + color: #515151; + background-color: #fff; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; +} + +/* No `:visited` state is required by default (browsers will use `a`) */ +a { + color: #268bd2; + text-decoration: none; +} +/* `:focus` is linked to `:hover` for basic accessibility */ +a:hover, +a:focus { + text-decoration: underline; +} + +/* Headings */ +h1, h2, h3, h4, h5, h6 { + margin-bottom: .5rem; + font-weight: bold; + line-height: 1.25; + color: #313131; + text-rendering: optimizeLegibility; +} +h1 { + font-size: 2rem; +} +h2 { + margin-top: 1rem; + font-size: 1.5rem; +} +h3 { + margin-top: 1.5rem; + font-size: 1.25rem; +} +h4, h5, h6 { + margin-top: 1rem; + font-size: 1rem; +} + +/* Body text */ +p { + margin-top: 0; + margin-bottom: 1rem; +} + +strong { + color: #303030; +} + + +/* Lists */ +ul, ol, dl { + margin-top: 0; + margin-bottom: 1rem; +} + +dt { + font-weight: bold; +} +dd { + margin-bottom: .5rem; +} + +/* Misc */ +hr { + position: relative; + margin: 1.5rem 0; + border: 0; + border-top: 1px solid #eee; + border-bottom: 1px solid #fff; +} + +abbr { + font-size: 85%; + font-weight: bold; + color: #555; + text-transform: uppercase; +} +abbr[title] { + cursor: help; + border-bottom: 1px dotted #e5e5e5; +} + +/* Code */ +code, +pre { + font-family: Menlo, Monaco, "Courier New", monospace; +} +code { + padding: .25em .5em; + font-size: 85%; + color: #bf616a; + background-color: #f9f9f9; + border-radius: 3px; +} +pre { + display: block; + margin-top: 0; + margin-bottom: 1rem; + padding: 1rem; + font-size: .8rem; + line-height: 1.4; + overflow-x: scroll; + background-color: #f9f9f9; +} +pre code { + padding: 0; + font-size: 100%; + color: inherit; + background-color: transparent; +} +.highlight { + margin-bottom: 1rem; + border-radius: 4px; +} +.highlight pre { + margin-bottom: 0; +} + +/* Quotes */ +blockquote { + padding: .5rem 1rem; + margin: .8rem 0; + color: #7a7a7a; + border-left: .25rem solid #e5e5e5; +} +blockquote p:last-child { + margin-bottom: 0; +} +@media (min-width: 30em) { + blockquote { + padding-right: 5rem; + padding-left: 1.25rem; + } +} + +img { + display: block; + margin: 0 0 1rem; + border-radius: 5px; + max-width: 100%; +} + +/* Tables */ +table { + margin-bottom: 1rem; + width: 100%; + border: 1px solid #e5e5e5; + border-collapse: collapse; +} +td, +th { + padding: .25rem .5rem; + border: 1px solid #e5e5e5; +} +tbody tr:nth-child(odd) td, +tbody tr:nth-child(odd) th { + background-color: #f9f9f9; +} + + +/* + * Custom type + * + * Extend paragraphs with `.lead` for larger introductory text. + */ + +.lead { + font-size: 1.25rem; + font-weight: 300; +} + + +/* + * Messages + * + * Show alert messages to users. You may add it to single elements like a `<p>`, + * or to a parent if there are multiple elements to show. + */ + +.message { + margin-bottom: 1rem; + padding: 1rem; + color: #717171; + background-color: #f9f9f9; +} + + +/* + * Container + * + * Center the page content. + */ + +.container { + max-width: 38rem; + padding-left: 1rem; + padding-right: 1rem; + margin-left: auto; + margin-right: auto; +} + + +/* + * Masthead + * + * Super small header above the content for site name and short description. + */ + +.masthead { + padding-top: 1rem; + padding-bottom: 1rem; + margin-bottom: 3rem; +} +.masthead-title { + margin-top: 0; + margin-bottom: 0; + color: #505050; +} +.masthead-title a { + color: #505050; +} +.masthead-title small { + font-size: 75%; + font-weight: 400; + color: #c0c0c0; + letter-spacing: 0; +} + + +/* + * Posts and pages + * + * Each post is wrapped in `.post` and is used on default and post layouts. Each + * page is wrapped in `.page` and is only used on the page layout. + */ + +.page, +.post { + margin-bottom: 4em; +} + +/* Blog post or page title */ +.page-title, +.post-title, +.post-title a { + color: #303030; +} +.page-title, +.post-title { + margin-top: 0; +} + +/* Meta data line below post title */ +.post-date { + display: block; + margin-top: -.5rem; + margin-bottom: 1rem; + color: #9a9a9a; +} + +/* Related posts */ +.related { + padding-top: 2rem; + padding-bottom: 2rem; + border-top: 1px solid #eee; +} +.related-posts { + padding-left: 0; + list-style: none; +} +.related-posts h3 { + margin-top: 0; +} +.related-posts li small { + font-size: 75%; + color: #999; +} +.related-posts li a:hover { + color: #268bd2; + text-decoration: none; +} +.related-posts li a:hover small { + color: inherit; +} + + +/* Footnotes */ +.footnote-definition:first-of-type { + border-top: 1px solid; + padding-top: 1rem; +} +.footnote-definition { + margin-top: 1rem; +} +.footnote-definition sup { + margin-left: -1rem; + float: left; +} + + +/* + * Pagination + * + * Super lightweight (HTML-wise) blog pagination. `span`s are provide for when + * there are no more previous or next posts to show. + */ + +.pagination { + overflow: hidden; /* clearfix */ + margin-left: -1rem; + margin-right: -1rem; + font-family: "PT Sans", Helvetica, Arial, sans-serif; + color: #ccc; + text-align: center; +} + +/* Pagination items can be `span`s or `a`s */ +.pagination-item { + display: block; + padding: 1rem; + border: 1px solid #eee; +} +.pagination-item:first-child { + margin-bottom: -1px; +} + +/* Only provide a hover state for linked pagination items */ +a.pagination-item:hover { + background-color: #f5f5f5; +} + +@media (min-width: 30em) { + .pagination { + margin: 3rem 0; + } + .pagination-item { + float: left; + width: 50%; + } + .pagination-item:first-child { + margin-bottom: 0; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + } + .pagination-item:last-child { + margin-left: -1px; + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + } +} + +/* + * __ __ + * /\ \ /\ \ + * \ \ \___ __ __ \_\ \ __ + * \ \ _ `\/\ \/\ \ /'_` \ /'__`\ + * \ \ \ \ \ \ \_\ \/\ \_\ \/\ __/ + * \ \_\ \_\/`____ \ \___,_\ \____\ + * \/_/\/_/`/___/> \/__,_ /\/____/ + * /\___/ + * \/__/ + * + * Designed, built, and released under MIT license by @mdo. Learn more at + * https://github.com/poole/hyde. + */ + + +/* + * Contents + * + * Global resets + * Sidebar + * Container + * Reverse layout + * Themes + */ + + +/* + * Global resets + * + * Update the foundational and global aspects of the page. + */ + +html { + font-family: "PT Sans", Helvetica, Arial, sans-serif; +} +@media (min-width: 48em) { + html { + font-size: 16px; + } +} +@media (min-width: 58em) { + html { + font-size: 20px; + } +} + + +/* + * Sidebar + * + * Flexible banner for housing site name, intro, and "footer" content. Starts + * out above content in mobile and later moves to the side with wider viewports. + */ + +.sidebar { + text-align: center; + padding: 2rem 1rem; + color: rgba(255,255,255,.5); + background-color: #202020; +} +@media (min-width: 48em) { + .sidebar { + position: fixed; + top: 0; + left: 0; + bottom: 0; + width: 18rem; + text-align: left; + } +} + +/* Sidebar links */ +.sidebar a { + color: #fff; +} + +/* About section */ +.sidebar-about h1 { + color: #fff; + margin-top: 0; + font-family: "Abril Fatface", serif; + font-size: 3.25rem; +} + +/* Sidebar nav */ +.sidebar-nav { + padding-left: 0; + list-style: none; +} +.sidebar-nav-item { + display: block; +} +a.sidebar-nav-item:hover, +a.sidebar-nav-item:focus { + text-decoration: underline; +} +.sidebar-nav-item.active { + font-weight: bold; +} + +/* Sticky sidebar + * + * Add the `sidebar-sticky` class to the sidebar's container to affix it the + * contents to the bottom of the sidebar in tablets and up. + */ + +@media (min-width: 48em) { + .sidebar-sticky { + position: absolute; + right: 1rem; + bottom: 1rem; + left: 1rem; + } + + // The #{} stuff is needed because of https://github.com/sass/sass/issues/2378 + @supports(padding: m#{a}x(0px)) { + body:not(.layout-reverse) .sidebar-sticky { + // Notch is to left of sidebar; pad appropriately + padding-left: m#{a}x(1rem, env(safe-area-inset-left)); + } + + .layout-reverse .sidebar-sticky { + // Support iPhone X rounded corners and notch in landscape + // Notch is to right of sidebar; pad appropriately + padding-right: m#{a}x(1rem, env(safe-area-inset-right)); + } + } +} + + +/* Container + * + * Align the contents of the site above the proper threshold with some margin-fu + * with a 25%-wide `.sidebar`. + */ + +.content { + padding-top: 4rem; + padding-bottom: 4rem; +} + +@supports(padding: m#{a}x(0px)) { + body:not(.layout-reverse) .content { + // Notch is to right of content text; pad it appropriately + padding-right: m#{a}x(1rem, env(safe-area-inset-right)); + } + + .layout-reverse .content { + // Notch is to left of content text; pad it appropriately + padding-left: m#{a}x(1rem, env(safe-area-inset-left)); + } +} + + +@media (min-width: 48em) { + .content { + max-width: 38rem; + margin-left: 20rem; + margin-right: 2rem; + } +} + +@media (min-width: 64em) { + .content { + margin-left: 22rem; + margin-right: 4rem; + } +} + + +/* + * Reverse layout + * + * Flip the orientation of the page by placing the `.sidebar` on the right. + */ + +@media (min-width: 48em) { + .layout-reverse .sidebar { + left: auto; + right: 0; + } + .layout-reverse .content { + margin-left: 2rem; + margin-right: 20rem; + } +} + +@media (min-width: 64em) { + .layout-reverse .content { + margin-left: 4rem; + margin-right: 22rem; + } +} + + + +/* + * Themes + * + * As of v1.1, Hyde includes optional themes to color the sidebar and links + * within blog posts. To use, add the class of your choosing to the `body`. + */ + +/* Base16 (http://chriskempson.github.io/base16/#default) */ + +/* Red */ +.theme-base-08 .sidebar { + background-color: #ac4142; +} +.theme-base-08 .content a, +.theme-base-08 .related-posts li a:hover { + color: #ac4142; +} + +/* Orange */ +.theme-base-09 .sidebar { + background-color: #d28445; +} +.theme-base-09 .content a, +.theme-base-09 .related-posts li a:hover { + color: #d28445; +} + +/* Yellow */ +.theme-base-0a .sidebar { + background-color: #f4bf75; +} +.theme-base-0a .content a, +.theme-base-0a .related-posts li a:hover { + color: #f4bf75; +} + +/* Green */ +.theme-base-0b .sidebar { + background-color: #90a959; +} +.theme-base-0b .content a, +.theme-base-0b .related-posts li a:hover { + color: #90a959; +} + +/* Cyan */ +.theme-base-0c .sidebar { + background-color: #75b5aa; +} +.theme-base-0c .content a, +.theme-base-0c .related-posts li a:hover { + color: #75b5aa; +} + +/* Blue */ +.theme-base-0d .sidebar { + background-color: #6a9fb5; +} +.theme-base-0d .content a, +.theme-base-0d .related-posts li a:hover { + color: #6a9fb5; +} + +/* Magenta */ +.theme-base-0e .sidebar { + background-color: #aa759f; +} +.theme-base-0e .content a, +.theme-base-0e .related-posts li a:hover { + color: #aa759f; +} + +/* Brown */ +.theme-base-0f .sidebar { + background-color: #8f5536; +} +.theme-base-0f .content a, +.theme-base-0f .related-posts li a:hover { + color: #8f5536; +} + + +/* LaTeX Style Reset */ + +body.libertinus { + font-family: 'Libertinus', Georgia, Cambria, 'Times New Roman', Times, serif; +} + +body { + font-family: 'Latin Modern', Georgia, Cambria, 'Times New Roman', Times, serif; + text-rendering: optimizeLegibility; +} diff --git a/templates/base.html b/templates/base.html index 0ff6f13..37265f5 100644 --- a/templates/base.html +++ b/templates/base.html @@ -2,14 +2,26 @@ <html lang="en"> <head> {% block head %} - <link rel="stylesheet" href="https://unpkg.com/latex.css/style.min.css" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> + + <title>{% block title %}{% endblock %} + + + + + + + - {% block title %}{% endblock %} - @@ -29,9 +41,11 @@ {% endblock %} - - {% include "header.html" %} + + {% include "sidebar.html" %} +