Remark

1.4.1

Convert HTML to Markdown with OG metadata extraction and front matter generation ๐ŸŽจโœจ
1amageek/Remark

What's New

1.4.1

2026-01-31T05:03:13Z

Fix

  • Remove styleSheet from default blocked resources (nonessential) to fix SPA sites (e.g. Apple Developer Documentation) failing to load content

Remark ๐ŸŽจโœจ

Convert HTML to beautiful Markdown with ease! โœจ Remark is a Swift library and command-line tool designed to parse HTML content into Markdown, with support for extracting Open Graph (OG) metadata and front matter generation. Perfect for static site generators and Markdown-based applications! ๐Ÿš€

โœจ Features

  • ๐Ÿ“ HTML to Markdown Conversion: Convert HTML elements to clean, readable Markdown
  • ๐ŸŒ Open Graph (OG) Data Extraction: Extract social media tags automatically
  • ๐Ÿ“‹ Front Matter Generation: Generate front matter with title, description, and OG metadata
  • ๐ŸŽฏ Smart Indentation: Perfect handling of nested lists and quotes
  • ๐Ÿ”— URL Resolution: Automatically resolves relative URLs to absolute URLs
  • ๐ŸŽจ Intelligent Link Text: Prioritizes accessibility with aria-label > img[alt] > title > text

๐Ÿš€ Installation

๐Ÿ“š As a Library (Swift Package Manager)

Add Remark to your Package.swift:

dependencies: [
    .package(url: "https://github.com/1amageek/Remark.git", branch: "main")
]

๐Ÿ’ป As a Command Line Tool

๐Ÿƒ Using Mint (Recommended)

Mint is the easiest way to install Swift command line tools! ๐Ÿš€

mint install 1amageek/Remark

That's it! Now you can use remark from anywhere! โœจ

๐Ÿ›  Using Make

  1. Clone the repo and move into it:
git clone https://github.com/1amageek/Remark.git
cd Remark
  1. Install with make:
make install

Want a custom location? No problem! ๐ŸŽฏ

PREFIX=/your/custom/path make install

๐Ÿ”ง Manual Installation

  1. Clone the repo ๐Ÿ“ฆ
  2. Build release version:
swift build -c release
  1. Copy to your bin:
cp .build/release/remark /usr/local/bin/remark

๐ŸŽฎ Usage

๐Ÿ–ฅ Command Line Interface

Convert HTML from any URL to Markdown: โœจ

remark https://example.com

Include the fancy front matter: ๐Ÿ“‹

remark --include-front-matter https://example.com

Just the plain text, please! ๐Ÿ“

remark --plain-text https://example.com

๐Ÿ“š Library Usage

Here's a quick example to get you started! ๐Ÿš€

import Remark

let htmlContent = """
<!DOCTYPE html>
<html>
<head>
    <title>My Amazing Page โœจ</title>
    <meta name="description" content="Something awesome!">
    <meta property="og:image" content="https://example.com/cool.jpg">
</head>
<body>
    <h1>Welcome! ๐ŸŽ‰</h1>
    <p>This is <strong>amazing</strong> content.</p>
</body>
</html>
"""

do {
    let remark = try Remark(htmlContent)
    print("โœจ Title:", remark.title)
    print("๐Ÿ“ Description:", remark.description)
    print("๐ŸŒ OG Data:", remark.ogData)
    print("๐Ÿ“„ Markdown:\n", remark.page)
} catch {
    print("โŒ Error:", error)
}

๐ŸŽจ Example Output

Your HTML becomes beautiful Markdown:

---
title: "My Amazing Page โœจ"
description: "Something awesome!"
og_image: "https://example.com/cool.jpg"
---

# Welcome! ๐ŸŽ‰

This is **amazing** content.

๐Ÿ›  Development

๐Ÿ— Building

make build      # ๐Ÿš€ Release build
make debug      # ๐Ÿ” Debug build

๐Ÿงช Testing

make test       # ๐ŸŽฏ Run tests

๐Ÿงน Cleaning

make clean      # ๐Ÿงน Clean build artifacts

๐Ÿ“ฆ Dependencies

make update     # ๐Ÿ”„ Update all dependencies
make resolve    # ๐ŸŽฏ Resolve dependencies

๐Ÿงช Tests

Here's an example test for OGP extraction using Swift Testing:

import Testing
@testable import Remark

@Test("OGP data extraction")
func testOGPDataExtraction() throws {
    let htmlContent = """
    <meta property="og:image" content="https://example.com/cool.jpg" />
    <meta property="og:title" content="Amazing Page โœจ" />
    """

    let remark = try Remark(htmlContent)
    #expect(remark.ogData["og_image"] == "https://example.com/cool.jpg")
    #expect(remark.ogData["og_title"] == "Amazing Page โœจ")
}

๐ŸŒŸ Contributing

Love Remark? Want to make it better? Contributions are welcome! ๐ŸŽ‰

  1. ๐Ÿด Fork it
  2. ๐Ÿ”จ Make your changes
  3. ๐Ÿงช Test them
  4. ๐ŸŽฏ Send a PR

๐Ÿ“ License

Remark is available under the MIT license. See the LICENSE file for more info. โœจ

Description

  • Swift Tools 6.0.0
View More Packages from this Author

Dependencies

Last updated: Mon Feb 02 2026 01:34:19 GMT-1000 (Hawaii-Aleutian Standard Time)