Files
mdsnippets/README.md
2023-09-27 19:54:24 +03:00

1.1 KiB

MDSnippets

MDSnippets is a static HTML page with JS markdown parser to create a generic snippet storage

Snippets are syntax highlighted with highlight.js. See their documentation for language names.

UI

  • At the top there is a search bar. Enter values to filter snippet names.
  • Pressing key 's' or / focuses the search bar.
  • Cycling results with TAB shows the code, and selects it
  • Copy with keyboard and paste where you want

Configuration

config.js:

  • File is read to replace values in "config.xx" object.
  • config.source='path_to_markdown.txt';
  • config.style='path_to_style.css';
  • config.title='Title of page';
  • config.search=true; // Display link search bar
  • config.favicon='path_to_favicon.ico';

Markdown

Only 1st level heads, names and code blocks are parsed:

# header

name
\`\`\`python
print("Hello World!")
# Do not escape the backticks in real config.
\`\`\`

Static HTML builder

Sometimes the reloading of styles and links is hard due to caching. You can create a static single HTML page with:

bash build_static.sh  -l example_snippets.txt -c config.js -s style.css  > templated.html