### Serve Jekyll Site
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_install_jekyll_on_windows.md
Starts a local web server to preview the Jekyll site. This command builds the site and makes it accessible via a local URL in your web browser.
```bash
jekyll serve
```
--------------------------------
### Add Gems to Gemfile
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_installing_bundler.md
Example content for a Gemfile, specifying the RubyGems.org source and listing several gems. These gems will be installed by Bundler.
```ruby
source 'https://rubygems.org'
gem 'github-pages'
gem 'pygments.rb'
gem 'redcarpet'
gem 'jekyll'
```
--------------------------------
### Create a Gemfile
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_installing_bundler.md
Generates a new Gemfile for a project. The Gemfile specifies the project's dependencies.
```shell
bundle init
```
--------------------------------
### Gemfile Version Specification Examples
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_about_ruby_gems_bundler.md
These examples illustrate various ways to specify gem versions within a Gemfile. They cover exact version matching, approximate version ranges using '~>', and combined version constraints.
```ruby
gem 'kramdown', '1.0'
```
```ruby
gem 'jekyll', '~> 2.3'
```
```ruby
gem `jekyll`, `~>2.3.1'
```
```ruby
gem 'jekyll', '~> 3.0', '>= 3.0.3'
```
--------------------------------
### Install Bundler
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_installing_bundler.md
Installs Bundler, a Ruby gem that manages project dependencies. This command is run after rbenv is initialized and a Ruby version is selected.
```ruby
gem install bundler
```
--------------------------------
### Example Gemfile Configuration
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_about_ruby_gems_bundler.md
This snippet demonstrates a basic Gemfile structure for a Ruby project, specifying the source for gems and listing required gems like 'github-pages' and 'jekyll'. It shows how to declare gem dependencies for Bundler.
```ruby
source "https://rubygems.org"
gem 'github-pages'
gem 'jekyll'
```
--------------------------------
### Install Homebrew
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_installing_bundler.md
Installs Homebrew, a package manager for macOS, using a Ruby script. This is a prerequisite for installing other development tools like rbenv.
```shell
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
--------------------------------
### Kramdown Configuration Example
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_pages.md
Shows a typical configuration for Kramdown, the default Markdown processor. It specifies the highlighter, markdown processor, and Kramdown-specific options like input format, automatic ID generation, hard wrap behavior, and syntax highlighter.
```yaml
highlighter: rouge
markdown: kramdown
kramdown:
input: GFM
auto_ids: true
hard_wrap: false
syntax_highlighter: rouge
```
--------------------------------
### Install Bundler and Initialize Gemfile
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_install_jekyll_on_windows.md
Installs the Bundler package manager and initializes a Gemfile for managing Ruby gem dependencies. This is crucial for projects that rely on specific gems, like Jekyll themes.
```bash
gem install bundler
bundle init
```
--------------------------------
### Execute Project Commands with Bundler
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_installing_bundler.md
Executes a command (e.g., 'jekyll serve') within the context of the project's dependencies managed by Bundler. This ensures the command uses the correct gem versions.
```shell
bundle exec jekyll serve
```
--------------------------------
### Error Example: Invalid Include Syntax (Liquid)
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_alerts.md
Shows an example of incorrect Liquid syntax when attempting to use Liquid variables directly within an include parameter, which results in a Liquid Exception error during site build.
```liquid
{% raw %}{% include note.html content="The {{site.company}} is pleased to announce an upcoming release." %}{% endraw %}
```
--------------------------------
### YAML Configuration Example
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_alerts.md
A snippet showing how a variable like 'company_name' can be defined in a site's configuration file (_config.yml) using YAML format.
```yaml
company_name: Your company
```
--------------------------------
### Post Frontmatter Example (YAML)
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_posts.md
This snippet demonstrates the allowed frontmatter configuration for a post. It includes essential fields like title and tags, along with optional fields for keywords, sidebar, permalink, and summary, which are crucial for content organization and SEO.
```yaml
---
title: My sample post
tags: content_types
keywords: pages, authoring, exclusion, frontmatter
sidebar: mydoc_sidebar
permalink: mydoc_pages.html
summary: "This is some summary frontmatter for my sample post."
---
```
--------------------------------
### Initialize rbenv
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_installing_bundler.md
Initializes rbenv in the current terminal session. This command sets up rbenv to manage Ruby versions.
```shell
rbenv init
```
--------------------------------
### Install rbenv using Homebrew
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_installing_bundler.md
Installs rbenv, a Ruby version management tool, using the Homebrew package manager. rbenv allows you to easily switch between different Ruby versions.
```shell
brew install rbenv
```
--------------------------------
### Build and Serve Jekyll Sites
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_build_arguments.md
Commands to build a Jekyll site and serve it with live reloading. The 'build' command generates the static site, while 'serve' builds and starts a local web server. Custom configurations and output directories can be specified.
```bash
jekyll build
```
```bash
jekyll serve
```
```bash
jekyll serve --config configs/myspecialconfig.yml --destination ../doc_outputs
```
--------------------------------
### Generate List of Pages by Tag using Liquid
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_kb_layout.md
This Liquid template snippet iterates through all site pages, sorts them by title, and checks each page's tags. If a page has the specified tag ('getting_started' in this example), it generates an HTML list item with a link to that page. This is useful for dynamically creating tag-based indexes.
```liquid
{% raw %}
Getting started pages:
{% assign sorted_pages = site.pages | sort: 'title' %}
{% for page in sorted_pages %}
{% for tag in page.tags %}
{% if tag == "getting_started" %}
- {{page.title}}
{% endif %}
{% endfor %}
{% endfor %}
{% endraw %}
```
--------------------------------
### Bundler Dependency Resolution Example
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_about_ruby_gems_bundler.md
This output shows a list of gems and their specific versions that Bundler resolved for the 'github-pages' gem. It highlights how Bundler manages dependencies and ensures version compatibility.
```text
github-pages-health-check = 1.1.0
jekyll = 3.0.3
jekyll-coffeescript = 1.0.1
jekyll-feed = 0.4.0
jekyll-gist = 1.4.0
jekyll-github-metadata = 1.9.0
jekyll-mentions = 1.1.2
jekyll-paginate = 1.1.0
jekyll-redirect-from = 0.10.0
jekyll-sass-converter = 1.3.0
jekyll-seo-tag = 1.3.2
jekyll-sitemap = 0.10.0
jekyll-textile-converter = 0.1.0
jemoji = 0.6.2
kramdown = 1.10.0
liquid = 3.0.6
mercenary ~> 0.3
rdiscount = 2.1.8
redcarpet = 3.3.3
RedCloth = 4.2.9
rouge = 1.10.1
terminal-table ~> 1.
```
--------------------------------
### Create Tooltip Page in Jekyll Collection
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_help_api.md
This example shows how to create a page within a Jekyll collection (specifically, the `_tooltips` folder). It uses frontmatter to define a unique `doc_id` and `product`, and then references the tooltip definition from the `_data/definitions.yml` file using Liquid templating.
```html
---
doc_id: basketball
product: mydoc
---
{{site.data.definitions.basketball}}
```
--------------------------------
### Install Jekyll Dependencies with Bundler
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_install_jekyll_on_windows.md
Installs all the Ruby gems and their dependencies listed in the project's Gemfile. This command ensures that all required packages are downloaded and available for the Jekyll project.
```bash
bundle install
```
--------------------------------
### Bootstrap Label Examples (HTML)
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_labels.md
Demonstrates the usage of various Bootstrap label styles, including default, primary, success, info, warning, and danger. These can be used to visually categorize or tag elements on a webpage.
```html
Default
Primary
Success
Info
Warning
Danger
```
--------------------------------
### Markdown Heading Syntax
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_pages.md
Illustrates the standard Markdown syntax for creating headings using pound signs. It shows examples for second, third, and fourth-level headings and emphasizes the requirement of a space before and after the pound signs for proper rendering.
```markdown
## Second-level heading
```
```markdown
### Third-level heading
```
```markdown
#### Fourth-level heading
```
--------------------------------
### Rendering YAML Feedback and Block Content with Liquid
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_yaml_tutorial.md
Shows how to render YAML data, specifically 'feedback' and 'block' fields, within a Markdown context using Liquid templating. This example highlights the output of the different line break handling methods from YAML.
```liquid
{% raw %}Feedback
{{site.data.samplelist.feedback}}
Block
{{site.data.samplelist.block}}
{% endraw %}
```
--------------------------------
### Callout Examples for Different Types
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_alerts.md
Illustrates the visual appearance of callouts with different 'type' properties. The available types are danger, default, primary, success, info, and warning, each affecting the border color.
```html
{% include callout.html content="This is my **danger** type callout. It has a border on the left whose color you define by passing a type parameter." type="danger" %}
```
```html
{% include callout.html content="This is my **default** type callout. It has a border on the left whose color you define by passing a type parameter." type="default" %}
```
```html
{% include callout.html content="This is my **primary** type callout. It has a border on the left whose color you define by passing a type parameter." type="primary" %}
```
```html
{% include callout.html content="This is my **success** type callout. It has a border on the left whose color you define by passing a type parameter." type="success" %}
```
```html
{% include callout.html content="This is my **info** type callout. It has a border on the left whose color you define by passing a type parameter." type="info" %}
```
```html
{% include callout.html content="This is my **warning** type callout. It has a border on the left whose color you define by passing a type parameter." type="warning" %}
```
--------------------------------
### Docker Build and Serve for Jekyll Site
Source: https://context7.com/ashemery/malware-tools/llms.txt
Provides bash scripts to build and serve a Jekyll site using Docker. This method avoids the need for local Ruby and Gem installations, ensuring consistent build environments. It mounts the current directory and vendor folder to the Docker container.
```bash
#!/usr/bin/env bash
# build.sh - Build Jekyll site with Docker
_JEKYLL_VERSION="${JEKYLL_VERSION:-3.8}"
# Build the site
docker run --rm \
-it \
--ipc=host \
--net=host \
--volume="${PWD}:/srv/jekyll:Z" \
--volume="${PWD}/vendor:/usr/local/bundle:Z" \
jekyll/jekyll:${_JEKYLL_VERSION} \
jekyll build
# Serve locally for development
docker run --rm \
-it \
--ipc=host \
--net=host \
--volume="${PWD}:/srv/jekyll:Z" \
--volume="${PWD}/vendor:/usr/local/bundle:Z" \
jekyll/jekyll:${_JEKYLL_VERSION} \
jekyll serve --host 0.0.0.0
# Output will be generated in _site/ directory
# Access local server at http://127.0.0.1:4000
```
--------------------------------
### Jekyll Shortcode for Callouts
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_icons.md
This example shows a Jekyll shortcode used to generate callout elements dynamically. It leverages site data to insert content into predefined callout structures.
```markdown
{% raw %}{{site.data.alerts.callout_info}}This is a special callout information message.{{site.data.alerts.end}}{% endraw %}
```
--------------------------------
### Jekyll Page Frontmatter Example
Source: https://context7.com/ashemery/malware-tools/llms.txt
Defines metadata for a Jekyll content page, controlling its title, tags, keywords, last updated date, summary, sidebar, permalink, and table of contents display.
```yaml
---
title: Alerts
tags: [formatting]
keywords: notes, tips, cautions, warnings, admonitions
last_updated: July 3, 2016
summary: "You can insert notes, tips, warnings, and important alerts in your content."
sidebar: mydoc_sidebar
permalink: mydoc_alerts.html
folder: mydoc
toc: true
---
Your markdown content goes here. The frontmatter controls:
- title: Page heading and browser tab title
- tags: Categorization for tag-based navigation
- keywords: SEO metadata for search engines
- last_updated: Displayed in page footer
- summary: Brief description shown in page layout
- sidebar: Which YAML sidebar file to use
- permalink: URL path (must match filename)
- toc: Whether to show table of contents (default true)
```
--------------------------------
### Configure SSL Certificate File Path (.bash_profile)
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_install_jekyll_on_mac.md
This code snippet shows how to set the SSL_CERT_FILE environment variable in your .bash_profile to point to the location of your downloaded cacert.pem file. This is required for secure communication with external services, including the GitHub API, when Jekyll rebuilds your site. Remember to update the path to reflect the actual location of your 'cacert.pem' file.
```bash
export SSL_CERT_FILE=/Users/johndoe/projects/cacert.pem
```
--------------------------------
### Iterate and Filter Pages by Tag (Jekyll)
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_shuffle.html
This snippet iterates through all pages in a Jekyll site and filters them based on a specific tag. It then generates a list of links to pages matching the tag. This is used for organizing content into sections like 'Getting Started', 'Content Types', etc.
```liquid
{% for page in site.pages %} {% for tag in page.tags %} {% if tag == "getting_started" %}* [{{page.title}}]({{page.url | remove: '/'}}) {% endif %} {% endfor %} {% endfor %}
```
```liquid
{% for page in site.pages %} {% for tag in page.tags %} {% if tag == "content-types" %}* [{{page.title}}]({{page.url | remove: '/'}}) {% endif %} {% endfor %} {% endfor %}
```
```liquid
{% for page in site.pages %} {% for tag in page.tags %} {% if tag == "formatting" %}* [{{page.title}}]({{page.url | remove: '/'}}) {% endif %} {% endfor %} {% endfor %}
```
```liquid
{% for page in site.pages %} {% for tag in page.tags %} {% if tag == "single_sourcing" %}* [{{page.title}}]({{page.url | remove: '/'}}) {% endif %} {% endfor %} {% endfor %}
```
```liquid
{% for page in site.pages %} {% for tag in page.tags %} {% if tag == "publishing" %}* [{{page.title}}]({{page.url | remove: '/'}}) {% endif %} {% endfor %} {% endfor %}
```
```liquid
{% for page in site.pages %} {% for tag in page.tags %} {% if tag == "special_layouts" %}* [{{page.title}}]({{page.url | remove: '/'}}) {% endif %} {% endfor %} {% endfor %}
```
--------------------------------
### Configure CORS for AWS S3 Buckets
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_help_api.md
This XML configuration allows GET requests from any origin to an AWS S3 bucket. It's added to the bucket's CORS settings to enable cross-origin access to files stored within the bucket. Note that this configuration might not work in all experimental setups.
```xml
*
GET
```
--------------------------------
### Install Ruby using Homebrew
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_install_jekyll_on_mac.md
Installs Ruby using the Homebrew package manager. After running this command, it is recommended to log out and log back into the terminal for the changes to take effect. This ensures Ruby and RubyGems are installed in a writable directory.
```bash
brew install ruby
```
--------------------------------
### Install Jekyll Gem
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_install_jekyll_on_windows.md
Installs the Jekyll gem, which is necessary for creating and managing Jekyll sites. This command requires Ruby and RubyGems to be pre-installed.
```bash
gem install jekyll
```
--------------------------------
### Retrieve Pages by Tag (Liquid)
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_tags.md
This snippet retrieves and displays pages that have a specific tag, 'getting_started'. It iterates through all site pages and their tags to find matches. This method can be inefficient for sites with a large number of pages.
```liquid
Getting started pages:
{% for page in site.pages %}
{% for tag in page.tags %}
{% if tag == "getting_started" %}
- {{page.title}}
{% endif %}
{% endfor %}
{% endfor %}
```
--------------------------------
### Include Images with Options (Liquid)
Source: https://context7.com/ashemery/malware-tools/llms.txt
Demonstrates how to include images in a project using the `image.html` and `inline_image.html` Liquid include templates. Supports parameters like file path, URL, alt text, caption, and max-width.
```liquid
{% include image.html file="jekyll.png" url="http://jekyllrb.com" alt="Jekyll Logo" caption="This is a sample caption" %}
{% include image.html file="helpapi.svg" alt="Help API Diagram" caption="Architecture diagram" max-width="600" %}
Click the **Analyze** button {% include inline_image.html file="analyze-icon.png" alt="Analyze button" %}
```
--------------------------------
### Update Homebrew on Mac
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_install_jekyll_on_mac.md
Updates Homebrew to the latest version if it is already installed on your computer. This command is executed in the Terminal.
```bash
brew update
```
--------------------------------
### PDF Generation with Prince XML and Jekyll
Source: https://context7.com/ashemery/malware-tools/llms.txt
Outlines the steps to generate PDF documentation from a Jekyll site using Prince XML. It involves serving a PDF-optimized version of the site and then using the `prince` command-line tool with a file list to create the PDF.
```bash
# Step 1: Serve PDF-friendly HTML
echo "Building PDF-friendly HTML site..."
jekyll serve --detach --config _config.yml,pdfconfigs/config_mydoc_pdf.yml
# Step 2: Generate PDF with Prince
echo "Building PDF..."
prince --javascript \
--input-list=../doc_outputs/mydoc/pdf/prince-file-list.txt \
-o files/mydoc_documentation.pdf
# prince-file-list.txt contains absolute URLs to all pages:
# http://127.0.0.1:4000/mydoc_introduction.html
# http://127.0.0.1:4000/mydoc_alerts.html
# http://127.0.0.1:4000/mydoc_images.html
```
--------------------------------
### Define Dynamic Guide Name Function (JavaScript)
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_generating_pdfs.md
This JavaScript code defines a script function 'guideName' for PrinceXML. It dynamically generates a string for the guide's title, incorporating a site variable for customization.
```javascript
```
--------------------------------
### Example Jekyll-Processed JSON Output
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_help_api.md
This is an example of the JSON output generated by Jekyll after processing the Liquid code. It shows a structured array of entries, where each entry contains a 'doc_id' and 'body'. The 'body' content is typically populated from Jekyll's data files or page content, as demonstrated.
```json
{
"entries": [
{
"doc_id": "baseball",
"body": "{{site.data.definitions.baseball}}"
},
{
"doc_id": "basketball",
"body": "{{site.data.definitions.basketball}}"
},
{
"doc_id": "football",
"body": "{{site.data.definitions.football}}"
},
{
"doc_id": "soccer",
"body": "{{site.data.definitions.soccer}}"
}
]
}
```
--------------------------------
### YAML Simple List Rendering with Liquid
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_yaml_tutorial.md
Illustrates how to define a simple list in YAML and then iterate over it using a Liquid 'for' loop in Markdown to display each list item's title. This is useful for creating basic lists of items.
```yaml
bikes:
- title: mountain bikes
- title: road bikes
- title: hybrid bikes
```
--------------------------------
### Error Example: Incorrect Quotation Marks in Include
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_alerts.md
Illustrates a common syntax error in Liquid includes where quotation marks are improperly used or omitted, leading to build failures.
```text
{% raw %}Liquid Exception: Invalid syntax for include tag: content="This is my **info** type callout. It has a border on the left whose color you define by passing a type parameter. type="info" Valid syntax: {% include file.ext param='value' param2='value' %} in mydoc/mydoc_alerts.md {% endraw %}
```
--------------------------------
### Retrieve and Sort Pages by Tag Alphabetically (Liquid)
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_tags.md
This snippet retrieves pages with the 'getting_started' tag and sorts them alphabetically by title. It first assigns the sorted pages to a variable 'sorted_pages' using the 'sort' filter. This approach is also subject to potential performance issues on very large sites.
```liquid
Getting started pages:
{% assign sorted_pages = site.pages | sort: 'title' %}
{% for page in sorted_pages %}
{% for tag in page.tags %}
{% if tag == "getting_started" %}
- {{page.title}}
{% endif %}
{% endfor %}
{% endfor %}
```
--------------------------------
### Serve PDF-Friendly HTML with Jekyll
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_build_scripts.md
This script kills existing Jekyll instances and then serves two versions of a PDF-friendly HTML site using Jekyll. It utilizes specific configuration files for writers and designers, preparing the output for PDF generation.
```shell
echo 'Killing all Jekyll instances'
kill -9 $(ps aux | grep '[j]ekyll' | awk '{print $2}')
clear
echo "Building PDF-friendly HTML site for Mydoc Writers ..."
jekyll serve --detach --config configs/mydoc/config_writers.yml,configs/mydoc/config_writers_pdf.yml
echo "done"
echo "Building PDF-friendly HTML site for Mydoc Designers ..."
jekyll serve --detach --config configs/mydoc/config_designers.yml,configs/mydoc/config_designers_pdf.yml
echo "done"
echo "All done serving up the PDF-friendly sites. Now let\'s generate the PDF files from these sites."
echo "Now run . mydoc_2_multibuild_pdf.sh"
```
--------------------------------
### Markdown Heading with ID Tag
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_pages.md
Demonstrates how to add a custom ID tag to a Markdown heading using curly braces. This allows for internal linking to specific sections of a page, as shown in the example of referencing the heading with an ID tag.
```markdown
## Headings with ID Tags {#someIdTag}
```
```markdown
[Some link](#someIdTag)
```
--------------------------------
### Push Documentation to GitHub Repository
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_build_scripts.md
This script navigates to the built documentation output directory, stages all changes, commits them with a message, and pushes the commit to the remote GitHub repository. It's useful for deploying site output to a repository that can be read by services like Cloud Cannon.
```shell
cd doc_outputs/mydoc/designers
git add --all
git commit -m "publishing latest version of docs"
git push
echo "All done pushing to Github"
echo "Here's the link to download the guides..."
cd ../../docs
```
--------------------------------
### General Git Commands
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_git_collaboration.md
Provides a summary of fundamental Git commands for tracking files, viewing changes, and committing work.
```bash
git add
git diff
git commit
```
--------------------------------
### Configure Gemfile for Jekyll Dependencies
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_install_jekyll_on_windows.md
Defines the Ruby gem sources and specifies necessary gems for a Jekyll project. The 'wdm' gem is particularly important for Windows users to enable directory polling for site rebuilding.
```ruby
source "https://rubygems.org"
gem 'wdm'
gem 'jekyll'
```
--------------------------------
### JavaScript Code Snippet within Markdown List
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_lists.md
An example of embedding a JavaScript code snippet within a Markdown list. The code is properly formatted using triple backticks and a language identifier.
```javascript
function alert("hello");
```
--------------------------------
### Implement Conditional Logic (Liquid)
Source: https://context7.com/ashemery/malware-tools/llms.txt
Enables single-sourcing by conditionally displaying content based on frontmatter variables (e.g., `page.platform`) or site configuration values (e.g., `site.output`). Supports `if`, `elsif`, `else`, and `unless`.
```liquid
{% if page.platform == "windows" %}
Use Process Hacker or Process Monitor for Windows analysis.
{% elsif page.platform == "linux" %}
Use strace and ltrace for Linux dynamic analysis.
{% endif %}
{% if site.output == "pdf" %}
This content only appears in PDF output.
{% endif %}
{% unless site.output == "pdf" %}
This interactive element is hidden in PDF output.
{% endunless %}
{% if page.audience == "analyst" and page.level == "advanced" %}
## Advanced Malware Unpacking Techniques
This section covers advanced unpacking for experienced analysts.
{% endif %}
{% capture tool_warning %}The {{site.company_name}} recommends using isolated VMs for all malware analysis.{% endcapture %}
{% include warning.html content=tool_warning %}
```
--------------------------------
### Apply Syntax Highlighting with Liquid Markup (Java)
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_syntax_highlighting.md
Shows how to use Liquid markup's `highlight` command within HTML files to achieve syntax highlighting for Java code. This method is an alternative to fenced code blocks for HTML contexts.
```java
{% highlight java %}
import java.util.Scanner;
public class ScannerAndKeyboard
{
public static void main(String[] args)
{ Scanner s = new Scanner(System.in);
System.out.print( "Enter your name: " );
String name = s.nextLine();
System.out.println( "Hello " + name + "!" );
}
}
{% endhighlight %}
```
--------------------------------
### Clone Github Repository using Git
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_publishing_github_pages.md
This command clones a Github repository to your local machine. Ensure Git is installed and replace the URL with your repository's HTTPS clone URL. This is a prerequisite for managing your project files locally.
```bash
git clone https://github.com/tomjoht/myreponame.git
```
--------------------------------
### Push Build to AWS S3
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_push_build_to_server.md
Copies local project files recursively to an AWS S3 bucket. Requires AWS CLI to be installed and configured. The first argument is the local source path, and the second is the S3 destination URI.
```bash
aws s3 cp ~/users/tjohnson/projects/mydocproject/ s3://[aws path]docpath/mydocproject --recursive
aws s3 cp ~/users/tjohnson/projects/anotherdocproject2/ s3://[aws path]docpath/anotherdocproject --recursive
```
--------------------------------
### Markdown and Liquid for Rendering YAML Simple List
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_yaml_tutorial.md
Demonstrates rendering a simple YAML list ('bikes') into an HTML unordered list using Liquid's 'for' loop. It accesses the 'title' property of each item in the list.
```liquid
{% raw %}
{% for item in site.data.samplelist.bikes %}
- {{item.title}}
{% endfor %}
{% endraw %}
```
--------------------------------
### Initialize Bootstrap Popovers and Load Data (JavaScript)
Source: https://github.com/ashemery/malware-tools/blob/main/tooltips.html
Initializes Bootstrap popovers with hover trigger and HTML content enabled. It then fetches data from 'tooltips.json' and dynamically assigns the 'data-content' attribute for specific elements based on 'doc_id'.
```javascript
$(document).ready(function(){
/*Bootstrap popovers are initialized with the following script. In the options, I'm setting the placement to be on the right, the trigger to be hover rather than click, and to allow HTML from the JSON data source. */
$('["data-toggle"="popover"]').popover({
placement : 'right',
trigger: 'hover',
html: true
});
/* Set the location where mydoc_tooltips_source.json is. */
var url = "tooltips.json";
$.get( url, function( data ) {
/* Bootstrap popover text is defined inside a data-content attribute inside an element. That's why I'm using attr here. If you just want to insert content on the page, use append and remove the data-content argument from the parentheses. */
$.each(data.entries, function(i, page) {
if (page.doc_id == "basketball") {
$( "#basketball" ).attr( "data-content", page.body );
}
if (page.doc_id == "baseball") {
$( "#baseball" ).attr( "data-content", page.body );
}
if (page.doc_id == "football") {
$( "#football" ).attr( "data-content", page.body );
}
if (page.doc_id == "soccer") {
$( "#soccer" ).attr( "data-content", page.body );
}
});
});
});
body {padding-left:50px;}
```
--------------------------------
### Project-Specific File Exclusion Strategies
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_excluding_files.md
These examples illustrate how to implement exclusion strategies for multiple projects (e.g., alpha and beta) by prefixing filenames. This allows for selective inclusion/exclusion of files based on project requirements, particularly when single-sourcing.
```yaml
exclude:
- alpha_*
```
```yaml
exclude:
- beta_*
```
--------------------------------
### Get Page Title and Number using Prince JavaScript
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_generating_pdfs.md
These JavaScript snippets for Prince allow you to dynamically set the content of elements to the document title or the current page number. They are useful for headers and footers in generated PDFs.
```javascript
content: string(doctitle);
```
```javascript
content: "Page " counter(page);
```
--------------------------------
### Mercurial (hg) Grep Command Usage
Source: https://github.com/ashemery/malware-tools/blob/main/pages/mydoc/mydoc_git_collaboration.md
The 'hg grep' command searches for a specified pattern across all versions of version-controlled files within a repository. It prints the first occurrence of the pattern found in any file version. The example searches for 'new' in 'apache2.conf'.
```bash
hg grep new apache2.conf
```