### Install and Run Tutorial Source: https://github.com/d0c-s4vage/lookatme/blob/main/README.md Install the latest version of lookatme and launch the built-in tutorial slides. Use `--pre` for release candidates. ```bash pip install --upgrade lookatme lookatme --tutorial ``` -------------------------------- ### Run lookatme presentation Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/index.md Execute this command to start a presentation from a Markdown file. ```bash lookatme slides.md ``` -------------------------------- ### Install lookatme via pip Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/index.md Use this command to install the lookatme package in your environment. ```bash pip install lookatme ``` -------------------------------- ### Start Python Interpreter Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Demonstrates how to start a Python interpreter in the terminal. This is useful for live coding demonstrations. ```terminal python3 ``` -------------------------------- ### Install Calendar Contrib Package Source: https://github.com/d0c-s4vage/lookatme/blob/main/examples/calendar_contrib/README.md Install this Python package into your virtual environment using pip. ```bash pip install ./examples/calendar_contrib ``` -------------------------------- ### Extended Terminal Usage Example Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/builtin_extensions/terminal.md An example of using the `terminal-ex` mode with specific configurations for command, rows, initial text, and language. ```markdown ```terminal-ex command: bash -il rows: 20 init_text: echo hello init_wait: '$> ' init_codeblock_lang: bash ``` ``` -------------------------------- ### YAML Metadata Header Configuration Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Configure presentation metadata, extensions, and styles using a YAML header at the start of the markdown file. This example shows custom styles for headings and margins. ```markdown --- title: Technical Deep Dive author: Jane Developer date: 2024-01-15 extensions: - terminal - qrcode styles: style: monokai table: column_spacing: 5 header_divider: "=" margin: top: 2 bottom: 2 left: 4 right: 4 padding: top: 3 bottom: 3 left: 8 right: 8 headings: "1": fg: "#ff0,bold" prefix: ">> " suffix: " <<" "2": fg: "#0ff,bold" prefix: "## " --- # First Slide Content with custom styling applied. ``` -------------------------------- ### Calendar Extension Setup (Python) Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Provides the `setup.py` configuration for packaging a custom Lookatme extension, specifically for the calendar functionality. It uses `setuptools` to define package metadata and find namespace packages. ```python # setup.py for lookatme.contrib.calendar from setuptools import setup, find_namespace_packages setup( name="lookatme.contrib.calendar", version="1.0.0", description="Adds calendar code block rendering to lookatme", author="Your Name", author_email="your@email.com", python_requires=">=3.6", packages=find_namespace_packages(include=["lookatme.*"]), ) ``` -------------------------------- ### QR Code Generation Source: https://github.com/d0c-s4vage/lookatme/blob/main/examples/tour.md Example of how to generate a QR code using the qrcode extension. The content within the qrcode block is encoded. ```qrcode hello ``` -------------------------------- ### Programmatic Usage of Lookatme (Python) Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Shows how to use Lookatme programmatically within a Python application. This example demonstrates creating a `Presentation` object from a markdown string and configuring various presentation options. ```python import io from lookatme.pres import Presentation # Create presentation from string markdown_content = """ --- title: Programmatic Slides author: API User --- # Slide 1 Hello from Python! --- # Slide 2 Programmatic presentations work great. """ # Create and run presentation input_stream = io.StringIO(markdown_content) pres = Presentation( input_stream, theme="dark", style_override="monokai", live_reload=False, single_slide=False, preload_extensions=["terminal"], safe=False, no_ext_warn=True, ignore_ext_failure=True, ) # Run the presentation pres.run(start_slide=0) ``` -------------------------------- ### Markdown Usage Example Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/builtin_extensions/file_loader.md Demonstrates how to use the file loader extension in markdown. The code block language is set to 'file', and the content is a YAML configuration specifying the file to load. ```markdown ```md ```file path: ../source/main.c lang: c ``` ``` ``` -------------------------------- ### Implement a Contrib Extension Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/slides.md Example of a custom render_code function that handles specific language tokens or raises IgnoredByContrib to fallback to default behavior. ```python import datetime import calendar import urwid from lookatme.exceptions import IgnoredByContrib def render_code(token, body, stack, loop): lang = token["lang"] or "" if lang != "calendar": raise IgnoredByContrib() today = datetime.datetime.utcnow() return urwid.Text(calendar.month(today.year, today.month)) ``` -------------------------------- ### Define Slide Metadata Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/slides.md Example of a YAML header for slide metadata including title, author, date, and extension/style placeholders. ```md --- title: TITLE author: AUTHOR date: 2019-12-02 extensions: [] styles: {} --- ``` -------------------------------- ### Display Bash While Loop in Terminal Source: https://github.com/d0c-s4vage/lookatme/blob/main/examples/terminal_ext/example.md This example shows how to display a bash while loop that continuously runs, sleeping for one second between iterations and printing the date. It is enclosed in a 'terminal8' fenced code block. ```bash bash -c "while true ; do sleep 1 ; date ; done" ``` -------------------------------- ### Calendar Extension with Custom Date Range Source: https://github.com/d0c-s4vage/lookatme/blob/main/examples/calendar_contrib/README.md This example shows how to specify a 'from' and 'to' date range within a calendar code block for future implementation. Note: These options are not implemented in the current toy extension. ```calendar from: 2019-05-01 to: 2019-11-01 ``` -------------------------------- ### Override Styles in Metadata Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/slides.md Example of overriding global style settings directly within the slide metadata YAML header. ```md --- title: TITLE author: AUTHOR date: 2019-12-02 styles: style: monokai table: column_spacing: 3 header_divider: "-" --- # Slide 1 text ``` -------------------------------- ### Live Editing Python Snippet Source: https://github.com/d0c-s4vage/lookatme/blob/main/examples/tour.md A Python code snippet intended for live editing. This example is shown in the context of Lookatme's live reload feature. ```python def a_function(test): print "Hello again from vim again" ``` -------------------------------- ### Example of Style Override Merging Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/style_precedence.md Illustrates how default styles, theme overrides, and slide YAML header overrides are merged to produce the final resolved style settings. Note how theme overrides affect 'headings.1.bg' and slide overrides affect 'headings.2.fg'. ```yaml headings: "1": fg: "#33c,bold" bg: "default" "2": fg: "#222,bold" bg: "default" ``` ```yaml headings: "1": bg: "#f00" ``` ```yaml headings: "2": fg: "#f00,bold,underline" ``` ```yaml headings: "1": fg: "#33c,bold" bg: "#f00" # from the theme "2": fg: "#f00,bold,underline" # from the slide YAML header bg: "default" ``` -------------------------------- ### Define extension setup.py Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/contrib_extensions_auto.md Use find_namespace_packages to include the lookatme.contrib namespace in the package distribution. ```python """ Setup for lookatme.contrib.calender example """ from setuptools import setup, find_namespace_packages import os setup( name="lookatme.contrib.calendar", version="0.0.0", description="Adds a calendar code block type", author="James Johnson", author_email="d0c.s4vage@gmail.com", python_requires=">=3.5", packages=find_namespace_packages(include=["lookatme.*"]), ) ``` -------------------------------- ### Run Basic Presentations Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Execute markdown presentations from the command line. Use --live for auto-updates on file changes or --tutorial to run the built-in tutorial. ```bash # Run a presentation lookatme slides.md # Run with live reload (auto-updates on file changes) lookatme --live slides.md # Run the built-in tutorial lookatme --tutorial # Show specific tutorial topics lookatme --tutorial markdown lookatme --tutorial general ``` -------------------------------- ### Lookatme CLI Options Reference Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Lists all available command-line options for the Lookatme tool, including debugging, logging, theming, styling, live reloading, extension management, and version information. Also shows how to set environment variables for extensions. ```bash lookatme [OPTIONS] [INPUT_FILES]... Options: --debug Enable debug logging -l, --log PATH Custom log file path --tutorial TEXT Show tutorials (all, general, markdown, help) -t, --theme [dark|light] Terminal theme --style STYLE Pygments syntax highlighting style --dump-styles Print resolved styles and exit --live, --live-reload Auto-reload on file changes -s, --safe Don't load extensions from markdown source --no-ext-warn Don't warn about new extensions -i, --ignore-ext-failure Ignore extension load failures -e, --exts TEXT Comma-separated extensions to preload --single, --one Render as single scrollable slide --version Show version --help Show help # Environment variable for extensions export LOOKATME_EXTS="terminal,qrcode" lookatme slides.md ``` -------------------------------- ### Load extensions with -e Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/getting_started.md Use the -e or --exts flag followed by a comma-separated list of extension names to pre-load extensions. ```bash lookatme slides.md -e EXT_NAME1,EXT_NAME2 ``` -------------------------------- ### Theme and Style Options Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Control the presentation's appearance using built-in themes (dark/light) and Pygments syntax highlighting styles. Use --dump-styles to see all resolved settings. ```bash # Use dark theme (default) lookatme slides.md --theme dark # Use light theme for light terminal backgrounds lookatme slides.md --theme light # Override syntax highlighting style lookatme slides.md --style monokai lookatme slides.md --style solarized-dark lookatme slides.md --style github-dark lookatme slides.md --style dracula # Dump resolved styles to see all settings lookatme slides.md --dump-styles ``` -------------------------------- ### Using Calendar Extension in Presentation (Markdown) Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Demonstrates how to enable and use the custom calendar extension within a Lookatme presentation. The `extensions` key in the front matter must include 'calendar'. ```markdown --- title: Calendar Demo extensions: - calendar --- # Current Month ```calendar ``` ``` -------------------------------- ### Virtual Environment Creation Commands Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Provides commands for creating virtual environments using different Python package management tools like venv, poetry, and pipenv. ```markdown | Tool | Command | |------|---------| | venv | `python -m venv .venv` | | poetry | `poetry init` | | pipenv | `pipenv install` | ``` -------------------------------- ### Lookatme CLI Usage Source: https://github.com/d0c-s4vage/lookatme/blob/main/README.md The main command for running lookatme presentations. It accepts various options to customize the presentation's behavior, styling, and extension loading. ```bash Usage: lookatme [OPTIONS] [INPUT_FILES]... lookatme - An interactive, terminal-based markdown presentation tool. See https://lookatme.readthedocs.io/en/v{{VERSION}} for documentation Options: --debug -l, --log PATH --tutorial TEXT As a flag: show all tutorials. With a value/comma-separated values: show the specific tutorials. Use the value 'help' for more help -t, --theme [dark|light] --style [default|emacs|friendly|friendly_grayscale|colorful|autumn|murphy|manni|material|monokai|perldoc|pastie|borland|trac|native|fruity|bw|vim|vs|tango|rrt|xcode|igor|paraiso-light|paraiso-dark|lovelace|algol|algol_nu|arduino|rainbow_dash|abap|solarized-dark|solarized-light|sas|staroffice|stata|stata-light|stata-dark|inkpot|zenburn|gruvbox-dark|gruvbox-light|dracula|one-dark|lilypond|nord|nord-darker|github-dark] --dump-styles Dump the resolved styles that will be used with the presentation to stdout --live, --live-reload Watch the input filename for modifications and automatically reload -s, --safe Do not load any new extensions specified in the source markdown. Extensions specified via env var or -e are still loaded --no-ext-warn Load new extensions specified in the source markdown without warning -i, --ignore-ext-failure Ignore load failures of extensions -e, --exts TEXT A comma-separated list of extension names to automatically load (LOOKATME_EXTS) --single, --one Render the source as a single slide --version Show the version and exit. --help Show this message and exit. ``` -------------------------------- ### Render as a single slide with --single Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/getting_started.md Use the --single or --one flag to render the markdown as a single slide, ignoring all horizontal rules. Use arrow keys and page up/down for navigation. ```bash lookatme slides.md --single ``` -------------------------------- ### Enable live reloading Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/getting_started.md Use the --live or --live-reload flag to enable live reloading. This watches the input markdown file for changes and re-renders the slide deck automatically. ```bash lookatme slides.md --live ``` -------------------------------- ### Apply a built-in theme Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/getting_started.md Use the --theme flag to apply one of the built-in themes, such as 'dark' or 'light'. ```bash lookatme slides.md --theme dark ``` -------------------------------- ### Load and Transform Binary File Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Load a binary file and transform it using a specified shell command. The `transform` option specifies the command to use, and `lines.end` limits the output. ```file path: image.png lang: text transform: xxd lines: end: 10 ``` -------------------------------- ### Define extension directory structure Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/contrib_extensions_auto.md Extensions use the implicit namespace package format, requiring no __init__.py file in the contrib path. ```text examples/calendar_contrib/ ├── lookatme │   └── contrib │   └── calendar.py └── setup.py ``` -------------------------------- ### Generate QR Codes with lookatme Source: https://github.com/d0c-s4vage/lookatme/blob/main/presentations/san_diego_python_meetup/2019-12-20.md This snippet demonstrates how to generate QR codes for URLs using the qrcode extension in lookatme. It specifies the data for the QR code and a caption. ```yaml columns: - data: "https://twitter.com/d0c_s4vage" caption: "Twitter: @d0c_s4vage" - data: "https://github.com/d0c-s4vage" caption: "GitHub: d0c-s4vage" ``` -------------------------------- ### Render Markdown with patat Source: https://github.com/d0c-s4vage/lookatme/blob/main/presentations/san_diego_python_meetup/2019-12-20.md This command uses the 'patat' tool to render a Markdown file. Patat is another command-line tool for presenting Markdown slides. ```bash patat examples/patat.md ``` -------------------------------- ### Enable debug logging Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/getting_started.md Use the --debug flag to enable debug logging. Logs are typically saved to a temporary directory named 'lookatme.log'. You can view the log in real-time using 'tail -f'. ```bash $> lookatme slides.md --debug # in another terminal $> tail -f /tmp/lookatme.log ``` ```text DEBUG:lookatme.RENDER: Rendering token {'type': 'heading', 'level': 2, 'text': 'TOC'} DEBUG:lookatme.RENDER: Rendering token {'type': 'list_start', 'ordered': False} DEBUG:lookatme.RENDER: Rendering token {'type': 'list_item_start'} DEBUG:lookatme.RENDER: Rendering token {'type': 'text', 'text': '[Features](#features)'} DEBUG:lookatme.RENDER: Rendering token {'type': 'list_start', 'ordered': False} DEBUG:lookatme.RENDER: Rendering token {'type': 'list_item_start'} ``` -------------------------------- ### Python Function with Type Hints Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Use type hints for better code documentation and static analysis. This function demonstrates type annotations for parameters and return values. ```python def greet(name: str, times: int = 1) -> str: """Return a greeting repeated n times.""" return f"Hello, {name}! " * times ``` -------------------------------- ### Extended Terminal Configuration Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Use the 'terminal-ex' block for advanced terminal configuration, including setting the command, rows, initial text, and wait conditions. ```markdown # Advanced Terminal ```terminal-ex command: bash -il rows: 15 init_text: echo "Hello from the presentation!" init_wait: '$> ' init_codeblock: true init_codeblock_lang: bash ``` This pre-loads the echo command and displays it in a code block before execution. ``` -------------------------------- ### Render Markdown with mdp Source: https://github.com/d0c-s4vage/lookatme/blob/main/presentations/san_diego_python_meetup/2019-12-20.md This command uses the 'mdp' tool to render a Markdown file. The --invert flag suggests a specific color scheme or display mode. ```bash mdp --invert examples/mdp.md ``` -------------------------------- ### Reference a Python source file Source: https://github.com/d0c-s4vage/lookatme/blob/main/examples/file_loader_ext/example.md Use the file directive to include external source code in your documentation. ```yaml path: hello_world.py lang: python ``` -------------------------------- ### Edit and display a Python Flask application with Vim Source: https://github.com/d0c-s4vage/lookatme/blob/main/presentations/san_diego_python_meetup/2019-12-20.md This command opens a Python Flask application file in Vim with syntax highlighting and line numbers enabled. It's intended for displaying source code during a presentation. ```bash bash -c "TERM=xterm-256color vim --clean ./source/minimal_flask.py -c 'colors peachpuff | set number'" ``` -------------------------------- ### Markdown for Progressive Slides Source: https://github.com/d0c-s4vage/lookatme/blob/main/examples/tour.md Demonstrates how to use the `` comment to progressively render content on a slide. Useful for revealing information step-by-step. ```markdown paragraph 1 paragraph 2 ``` -------------------------------- ### Loading External Files Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Use the 'file' extension to load and display content from external files directly into code blocks. Supports specifying language and line ranges. ```markdown # External Code Display Load and display a Python file: ```file path: src/main.py lang: python ``` --- # Partial File Display Show only specific lines from a file: ```file path: src/app.py lang: python lines: start: 10 end: 25 ``` ``` -------------------------------- ### QR Code Extended Configuration Source: https://github.com/d0c-s4vage/lookatme/blob/main/presentations/san_diego_python_meetup/2019-12-20.md Configures QR code generation with specific columns and captions. ```qrcode-ex columns: - data: https://www.youtube.com/watch?v=oHg5SJYRHA0 caption: Questions? ``` -------------------------------- ### Extended Terminal Configuration (YAML) Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/builtin_extensions/terminal.md The `terminal-ex` mode uses YAML to configure terminal behavior, including the command, rows, initial text, and expected prompt. ```yaml command: "the command to run" # required rows: 10 # number of rows for the terminal (height) init_text: null # initial text to feed to the command. This is # useful to, e.g., pre-load text on a # bash prompt so that only "enter" must be # pressed. Uses the `expect` command. init_wait: null # the prompt (string) to wait for with `expect` # this is required if init_text is set. init_codeblock: true # show a codeblock with the init_text as its # content init_codeblock_lang: text # the language of the init codeblock ``` -------------------------------- ### Transform and display file content Source: https://github.com/d0c-s4vage/lookatme/blob/main/examples/file_loader_ext/example.md Apply transformations like xxd and limit output lines when displaying binary or text files. ```yaml path: 1x1.png lang: text transform: xxd lines: end: 5 ``` -------------------------------- ### Add YAML header to slides Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/index.md Include an optional YAML block at the top of the file to define presentation metadata. ```md --- title: Slides Presentation author: Me Not You date: 2019-12-02 --- # Slide 1 Some text ``` -------------------------------- ### Default Style Settings (YAML) Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Defines the default styling options for Lookatme presentations, including themes, colors, fonts, and layout parameters. This YAML configuration controls the appearance of various elements like headings, links, and tables. ```yaml # Default dark theme styles author: bg: default fg: '#f30' bullets: '1': • '2': ⁃ '3': ◦ default: • date: bg: default fg: '#777' headings: '1': bg: default fg: '#9fc,bold' prefix: '██ ' suffix: '' '2': bg: default fg: '#1cc,bold' prefix: '▓▓▓ ' suffix: '' '3': bg: default fg: '#29c,bold' prefix: '▒▒▒▒ ' suffix: '' '4': bg: default fg: '#559,bold' prefix: '░░░░░ ' suffix: '' default: bg: default fg: '#346,bold' prefix: '░░░░░ ' suffix: '' hrule: char: ─ style: bg: default fg: '#777' link: bg: default fg: '#33c,underline' margin: bottom: 0 left: 2 right: 2 top: 0 numbering: '1': numeric '2': alpha '3': roman default: numeric padding: bottom: 0 left: 10 right: 10 top: 0 quote: bottom_corner: └ side: ╎ style: bg: default fg: italics,#aaa top_corner: ┌ slides: bg: default fg: '#f30' style: monokai table: column_spacing: 3 header_divider: ─ title: bg: default fg: '#f30,bold,italics' ``` -------------------------------- ### File Loader Extension Usage Source: https://github.com/d0c-s4vage/lookatme/blob/main/presentations/san_diego_python_meetup/2019-12-20.md Loads and transforms content from external files for display. ```file path: 2019-12-20.md transform: grep -e "^# " | sort lines: end: 10 ``` ```file path: 2019-12-20.md lang: md transform: grep -e "^# " | sort lines: end: 10 ``` ```file path: ./examples/lookatme_qrcode.md lang: md ``` -------------------------------- ### Embeddable Terminal (Docker) Source: https://github.com/d0c-s4vage/lookatme/blob/main/examples/tour.md Demonstrates embedding a Docker container terminal session within a slide. This allows for running commands in a clean, isolated environment. ```terminal docker run --rm -it ubuntu:18.04 ``` -------------------------------- ### Run a Flask application Source: https://github.com/d0c-s4vage/lookatme/blob/main/presentations/san_diego_python_meetup/2019-12-20.md This command runs a Flask application in development mode, enabling auto-reloading. It's used to demonstrate a running web application. ```bash bash -c "FLASK_APP=./source/minimal_flask.py flask run --reload" ``` -------------------------------- ### Set custom log location with --log Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/getting_started.md Specify a custom file path for the debug log using the --log flag. ```bash lookatme slides.md --debug --log /path/to/custom.log ``` -------------------------------- ### Load Relative File Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Load a file using a relative path. Set `relative: true` to indicate that the path is relative to the current directory. ```file path: ../configs/settings.json relative: true lang: json ``` -------------------------------- ### QR Code Extension Usage Source: https://github.com/d0c-s4vage/lookatme/blob/main/presentations/san_diego_python_meetup/2019-12-20.md Generates QR codes from provided input data. ```qrcode a ``` -------------------------------- ### Configure lookatme extensions in Markdown Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/contrib_extensions_auto.md Add the extension name to the extensions list in the YAML front matter of your slide file. ```md --- title: TITLE author: AUTHOR date: 2019-11-01 extensions: - XXX --- # Slide 1 ... ``` -------------------------------- ### Disable extension warnings with --no-ext-warn Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/getting_started.md Use the --no-ext-warn flag to suppress warnings about new extensions being loaded from the source markdown. ```bash lookatme slides.md --no-ext-warn ``` -------------------------------- ### Custom code block rendering in lookatme Source: https://github.com/d0c-s4vage/lookatme/blob/main/presentations/san_diego_python_meetup/2019-12-20.md This Python code defines a custom renderer for code blocks in lookatme. It uses the Pygments library for syntax highlighting. The `@contrib_first` decorator indicates it's an extension point. ```python @contrib_first def render_code(token, body, stack, loop): """Renders a code block using the Pygments library. See :any:`lookatme.tui.SlideRenderer.do_render` for additional argument and return value descriptions. """ lang = token.get("lang", "text") or "text" res = pygments_render.render_text(token["text"], lang=lang) return [ urwid.Divider(), res, urwid.Divider(), ] ``` -------------------------------- ### Dump resolved styles Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/getting_started.md Use the --dump-styles flag to print the final, resolved style definition based on the current command-line arguments and configuration. ```bash lookatme examples/tour.md -theme --style solarized-dark --dump-styles ``` -------------------------------- ### Default Style Settings in Lookatme Schemas Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/style_precedence.md Defines the default styles and formats used by Lookatme, including author, bullets, date, headings, hrule, link, margin, numbering, padding, quote, slides, style, table, and title. This configuration serves as the base for the dark theme. ```yaml author: bg: default fg: '#f30' bullets: '1': • '2': ⁃ '3': ◦ default: • date: bg: default fg: '#777' headings: '1': bg: default fg: '#9fc,bold' prefix: '██ ' suffix: '' '2': bg: default fg: '#1cc,bold' prefix: '▓▓▓ ' suffix: '' '3': bg: default fg: '#29c,bold' prefix: '▒▒▒▒ ' suffix: '' '4': bg: default fg: '#559,bold' prefix: '░░░░░ ' suffix: '' default: bg: default fg: '#346,bold' prefix: '░░░░░ ' suffix: '' hrule: char: ─ style: bg: default fg: '#777' link: bg: default fg: '#33c,underline' margin: bottom: 0 left: 2 right: 2 top: 0 numbering: '1': numeric '2': alpha '3': roman default: numeric padding: bottom: 0 left: 10 right: 10 top: 0 quote: bottom_corner: └ side: ╎ style: bg: default fg: italics,#aaa top_corner: ┌ slides: bg: default fg: '#f30' style: monokai table: column_spacing: 3 header_divider: ─ title: bg: default fg: '#f30,bold,italics' ``` -------------------------------- ### Ignore extension loading errors with -i Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/getting_started.md Use the -i flag to ignore hard errors during extension import, such as ImportErrors, while still showing warnings. ```bash lookatme slides.md -i ``` -------------------------------- ### Smart Slide Splitting by Headings Source: https://context7.com/d0c-s4vage/lookatme/llms.txt When horizontal rules are absent, lookatme automatically creates new slides based on H2 headings. H3 and lower headings remain on the same slide. ```markdown # Presentation Title This becomes the title (single h1). ## First Slide Content for the first slide. Each h2 heading creates a new slide. ## Second Slide Content for the second slide. ### Subsection This stays on the second slide since it's h3. ## Third Slide Final slide content. ``` -------------------------------- ### File Schema Definition Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/builtin_extensions/file_loader.md Defines the structure for YAML configuration used by the file loader extension. Specifies path, relativity, language, transformations, and line ranges. ```yaml path: path/to/the/file # required relative: true # relative to the slide source directory lang: text # pygments language to render in the code block transform: null # optional shell command to transform the file data lines: start: 0 end: null ``` -------------------------------- ### Embedding Live Terminals Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Embed interactive terminal sessions directly into slides using the 'terminal' extension. Specify the number of rows and the command to run. ```markdown # Live Terminal Demo An 8-row interactive bash terminal: ```terminal8 bash -il ``` --- # Docker Container Demo Drop into a Docker container during your presentation: ```terminal10 docker run --rm -it python:3.11-slim ``` --- # Running Commands A terminal showing a continuously running command: ```terminal8 bash -c "while true ; do sleep 1 ; date ; done" ``` ``` -------------------------------- ### Custom Calendar Extension (Python) Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Implement a custom Lookatme extension to render calendar code blocks. This Python code defines a `render_code` function that uses the `calendar` module to display the current month. ```python # lookatme/contrib/calendar.py """ Custom extension that renders calendar code blocks """ import datetime import calendar import urwid from lookatme.exceptions import IgnoredByContrib def user_warnings(): """Return security warnings for this extension (if any).""" return [] def render_code(token, body, stack, loop): """Override code block rendering for 'calendar' language.""" lang = token["lang"] or "" if lang != "calendar": # Let default behavior handle non-calendar blocks raise IgnoredByContrib() today = datetime.datetime.utcnow() return urwid.Text(calendar.month(today.year, today.month)) ``` -------------------------------- ### Basic Terminal Embedding Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/builtin_extensions/terminal.md Use `terminal` as the code block language to embed a terminal. The number specifies the height in rows. The code block content is the command to execute. ```markdown ```terminal8 bash -il ``` ``` -------------------------------- ### Declare Calendar Extension in YAML Source: https://github.com/d0c-s4vage/lookatme/blob/main/examples/calendar_contrib/README.md List the 'calendar' extension in the 'extensions' section of your slide deck's YAML header to enable its functionality. ```yaml --- title: An Awesome Presentation author: James Johnson date: 2019-11-19 extensions: - calendar --- ``` -------------------------------- ### Include Calendar in Presentation Source: https://github.com/d0c-s4vage/lookatme/blob/main/examples/calendar_contrib/example.md Requires the calendar extension to be enabled in the document metadata. The code block must contain at least one newline to render correctly. ```yaml --- title: An Awesome Presentation author: James Johnson date: 2019-11-19 extensions: - calendar --- ``` ```calendar ``` -------------------------------- ### File loader code block rendering in lookatme Source: https://github.com/d0c-s4vage/lookatme/blob/main/presentations/san_diego_python_meetup/2019-12-20.md This Python code defines an alternative renderer for code blocks, specifically for blocks with the language set to 'file'. It processes file information and then raises IgnoredByContrib to allow other renderers to handle it. ```python def render_code(token, body, stack, loop): """Render the code, ignoring all code blocks except ones with the language set to ``file``. """ lang = token["lang"] or "" if lang != "file": raise IgnoredByContrib file_info_data = token["text"] file_info = FileSchema().loads(file_info_data) # ... token["text"] = file_data token["lang"] = file_info["lang"] raise IgnoredByContrib ``` -------------------------------- ### Display Plain Bash Terminal Source: https://github.com/d0c-s4vage/lookatme/blob/main/examples/terminal_ext/example.md Use this to display a plain bash terminal session. Ensure the code is enclosed in a 'terminal8' fenced code block. ```bash bash -il ``` -------------------------------- ### Execute a Python script Source: https://github.com/d0c-s4vage/lookatme/blob/main/examples/file_loader_ext/example.md Run external scripts using the terminal directive. ```terminal python ./hello_world.py ``` -------------------------------- ### Progressive Slide Reveals Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Use `` comments between block elements in markdown to reveal content progressively on each slide. ```markdown # Progressive Reveal Demo First, this paragraph appears. Then this list: - Item 1 - Item 2 - Item 3 Finally, this conclusion appears! ``` -------------------------------- ### Define slides with hrules Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/index.md Use horizontal rules (---) to separate content into distinct slides. ```md # Slide 1 Some text --- # Slide 2 More text ``` -------------------------------- ### Markdown Slide Structure with Horizontal Rules Source: https://context7.com/d0c-s4vage/lookatme/llms.txt Define slides in markdown using '---' as horizontal rules to separate content. YAML metadata can be included at the beginning. ```markdown --- title: My Presentation author: John Doe date: 2024-01-15 --- # Slide 1 This is the first slide with some content. - Bullet point 1 - Bullet point 2 --- # Slide 2 This is the second slide. ## A Subheading More content here with **bold** and *italic* text. --- # Slide 3 Final slide with a code block: ```python def hello(): print("Hello, World!") ``` ``` -------------------------------- ### Disable new extensions with -s Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/getting_started.md Use the -s or --safe flag to prevent loading any new extensions specified in the markdown source. This ensures only manually allowed extensions are loaded. ```bash lookatme slides.md -s ``` -------------------------------- ### Override Pygments style Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/getting_started.md Use the --style flag to override the Pygments syntax highlighting style. A list of available styles is provided in the documentation. ```bash lookatme slides.md --style solarized-dark ``` -------------------------------- ### Display Current Month Calendar Source: https://github.com/d0c-s4vage/lookatme/blob/main/examples/calendar_contrib/README.md Use 'calendar' code blocks to display a text calendar of the current month on a slide after enabling the extension. ```markdown ```calendar ``` ``` -------------------------------- ### Override render_code function Source: https://github.com/d0c-s4vage/lookatme/blob/main/docs/source/contrib_extensions_auto.md Implement a function with the same name as the target lookatme function. Raise IgnoredByContrib to fall back to default rendering behavior. ```python """ Defines a calendar extension that overrides code block rendering if the language type is calendar """ import datetime import calendar import urwid from lookatme.exceptions import IgnoredByContrib def user_warnings(): """No warnings exist for this extension. Anything you want to warn the user about, such as security risks in processing untrusted markdown, should go here. """ return [] def render_code(token, body, stack, loop): lang = token["lang"] or "" if lang != "calendar": raise IgnoredByContrib() today = datetime.datetime.utcnow() return urwid.Text(calendar.month(today.year, today.month)) ``` -------------------------------- ### Python function definition with nested code block Source: https://github.com/d0c-s4vage/lookatme/blob/main/presentations/san_diego_python_meetup/2019-12-20.md This Python code defines a function and demonstrates nested code blocks within a Markdown list. It includes print statements and argument handling. ```python def this_is_a_function(arg1, arg2): print(f"arg1: {arg1}, arg2: {arg2}") return arg1 + arg2 if __name__ == "__main__": this_is_a_function(sys.argv[1], sys.argv[2]) ``` -------------------------------- ### Python Function Definition Source: https://github.com/d0c-s4vage/lookatme/blob/main/examples/tour.md A basic Python function definition. This is often used for custom logic or extensions within presentations. ```python def a_function(arg1, arg2): """This is a function """ print(arg1) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.