|
| 1 | +# TAGLINE |
| 2 | + |
| 3 | +Convert HyperCard 2.x stacks into self-contained HTML pages |
| 4 | + |
| 5 | +# TLDR |
| 6 | + |
| 7 | +**Convert** a stack, writing HTML next to the source file |
| 8 | + |
| 9 | +```hc2html ["My Stack"]``` |
| 10 | + |
| 11 | +**Write** the page to a chosen file |
| 12 | + |
| 13 | +```hc2html ["My Stack"] -o [my-stack.html]``` |
| 14 | + |
| 15 | +**Map** a classic Mac font to a CSS font stack |
| 16 | + |
| 17 | +```hc2html ["My Stack"] --font "[GoodDogPlain=Gochi Hand, cursive]"``` |
| 18 | + |
| 19 | +**Keep** field edits and new cards in the browser |
| 20 | + |
| 21 | +```hc2html ["My Stack"] --persist``` |
| 22 | + |
| 23 | +**Strip** HyperTalk scripts for a static viewer |
| 24 | + |
| 25 | +```hc2html ["My Stack"] --no-scripts``` |
| 26 | + |
| 27 | +**Also dump** pictures, icons, and sounds as files |
| 28 | + |
| 29 | +```hc2html ["My Stack"] --dump-assets [assets]``` |
| 30 | + |
| 31 | +**Decode** a Central European stack |
| 32 | + |
| 33 | +```hc2html ["My Stack"] --encoding [mac_latin2]``` |
| 34 | + |
| 35 | +**Also write** the intermediate JSON model |
| 36 | + |
| 37 | +```hc2html ["My Stack"] --json [model.json]``` |
| 38 | + |
| 39 | +# SYNOPSIS |
| 40 | + |
| 41 | +**hc2html** _STACK_ [**-o** _OUT.html_] [**--encoding** _ENC_] [**--title** _T_] [**--chrome** window|none] [**--persist**] [**--lenient**] [**--no-scripts**] [**--font** _NAME=CSS_] [**--start-card** _N_] [**--json** _FILE_] [**--dump-assets** _DIR_] [**-q**] |
| 42 | + |
| 43 | +# PARAMETERS |
| 44 | + |
| 45 | +**STACK** |
| 46 | +> HyperCard 2.x stack file (data fork, or a MacBinary **.bin**). |
| 47 | +
|
| 48 | +**-o**, **--output** _FILE_ |
| 49 | +> Output HTML path. Default is the stack path with **.html** appended (**.bin** is stripped first). |
| 50 | +
|
| 51 | +**--encoding** _ENC_ |
| 52 | +> Mac text encoding of the stack. Default **mac_roman**. Other Python **mac_*** codecs work, including **mac_latin2**, **mac_cyrillic**, **mac_greek**, **mac_turkish**, and **mac_iceland**. |
| 53 | +
|
| 54 | +**--title** _T_ |
| 55 | +> HTML page title. Default is the stack name. |
| 56 | +
|
| 57 | +**--chrome** **window**|**none** |
| 58 | +> Draw a classic Mac menu bar and window around the card (**window**, the default), or output the card alone. |
| 59 | +
|
| 60 | +**--persist** |
| 61 | +> Store field edits, hilites, and cards created with **doMenu "New Card"** in the browser's localStorage. |
| 62 | +
|
| 63 | +**--lenient** |
| 64 | +> Log unknown HyperTalk to the browser console instead of showing a HyperCard-style error dialog. |
| 65 | +
|
| 66 | +**--no-scripts** |
| 67 | +> Omit all HyperTalk from the viewer (static page). |
| 68 | +
|
| 69 | +**--font** _NAME=CSS_ |
| 70 | +> Map a Mac font name to a CSS font stack. Repeatable. |
| 71 | +
|
| 72 | +**--start-card** _N_ |
| 73 | +> 1-based card number to open first. Default **1**. |
| 74 | +
|
| 75 | +**--json** _FILE_ |
| 76 | +> Also write the intermediate JSON model (pictures as data URIs). |
| 77 | +
|
| 78 | +**--dump-assets** _DIR_ |
| 79 | +> Also write every picture, icon, pattern, and sound as files under _DIR_. |
| 80 | +
|
| 81 | +**-q**, **--quiet** |
| 82 | +> Do not print the conversion summary. |
| 83 | +
|
| 84 | +**--version** |
| 85 | +> Print **hc2html** _version_ and exit. |
| 86 | +
|
| 87 | +# DESCRIPTION |
| 88 | + |
| 89 | +**hc2html** reads a HyperCard 2.x stack and writes one self-contained HTML file. Card and background pictures, icons, sounds, font metadata, and scripts are embedded, so the page opens in a modern browser with no server. |
| 90 | + |
| 91 | +It parses HyperCard formats **8** (2.0/2.1) and **10** (2.2 and later): stack header, backgrounds, cards, button and field parts, unshared background field contents, unshared button hilites, the font table, card order from **LIST**/**PAGE** blocks, and WOBA-compressed pictures. Pictures are decoded to PNG with an alpha channel so unpainted card pixels show the background. |
| 92 | + |
| 93 | +The resource fork supplies **ICON**, **ICN#** (favicon), **CURS**, and **snd** resources (formats 1 and 2, uncompressed 8/16-bit, converted to WAV). The fork is looked up in this order: a native **..namedfork/rsrc** on macOS, **Stack.rsrc** beside the data fork, an AppleDouble **._Stack** file, or the stack itself as MacBinary **.bin**. |
| 94 | + |
| 95 | +The viewer draws the usual button and field styles, XOR hilites, and a HyperTalk subset (message hierarchy, chunks, **put**/**get**/**set**, **if**/**repeat**, **go**, visual effects, **answer**/**ask**, **play**, object properties, and common functions). Unknown statements raise a "Can't understand" dialog unless **--lenient** is set. Well-known externals such as **AddColor** are ignored with a console note. |
| 96 | + |
| 97 | +There are no Python package dependencies. The converter runs on Python 3.9+; the viewer is plain JavaScript. |
| 98 | + |
| 99 | +# CAVEATS |
| 100 | + |
| 101 | +HyperCard **1.x** stacks (format less than 8) are rejected; open them in HyperCard 2.x once and save. Paint tools, XCMDs/XFCNs, script-created menus, printing, file I/O, AppleScript, styled text runs inside fields, **privateAccess**, and encrypted stacks are not implemented. |
| 102 | + |
| 103 | +Icons and sounds are missing without a resource fork. Copying a stack through Windows, zip, or the web often drops the fork unless the file is MacBinary or kept with its **._** AppleDouble sidecar. |
| 104 | + |
| 105 | +# HISTORY |
| 106 | + |
| 107 | +**hc2html** 0.1.0 is an MIT-licensed preservation tool. Its WOBA decoder is a Python port of Rebecca Bettencourt's MIT-licensed C++ decoder from Uli Kusterer's **stackimport**. HyperCard itself was Apple's 1987 Macintosh authoring environment; this converter contains no HyperCard code or artwork, only a reader for the file format. |
| 108 | + |
| 109 | +# SEE ALSO |
| 110 | + |
| 111 | +[unar](/man/unar)(1), [python3](/man/python3)(1), [file](/man/file)(1), [pandoc](/man/pandoc)(1) |
| 112 | + |
| 113 | +# RESOURCES |
| 114 | + |
| 115 | +```[Source code](https://github.com/stachon/hc2html)``` |
| 116 | + |
| 117 | +<!-- verified: 2026-09-05 --> |
0 commit comments