Skip to main content

Python bindings for Yrs with sticky_index support for XML types

Project description

pycrdt-sticky-xml

A fork of pycrdt that adds sticky_index support for XML types (XmlElement and XmlText).

What's New

This fork extends the original pycrdt library by adding sticky_index functionality to XML types:

  • XmlElement.sticky_index(): Create sticky indices for XML element children
  • XmlText.sticky_index(): Create sticky indices within XML text content

Installation

pip install pycrdt-sticky-xml

Usage

from pycrdt_sticky_xml import Doc, XmlFragment, XmlElement, XmlText, Assoc

# Create a document with XML content
doc = Doc()
frag = doc.get("content", type=XmlFragment)

# Add XML text
text = XmlText("Hello World")
frag.children.append(text)

# Create a sticky index at position 5
idx = text.sticky_index(5, Assoc.AFTER)

# Insert text before the sticky position
text.insert(0, "Say ")

# The sticky index maintains its semantic position
print(idx.get_index())  # Now points to position 9 (after "Say Hello")

Features

  • All features from the original pycrdt
  • Sticky indices for XmlElement children
  • Sticky indices for XmlText content
  • Full compatibility with Yrs collaborative editing

Original Project

This is a fork of pycrdt. All credit for the core functionality goes to the original authors.

License

MIT License (same as original pycrdt)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycrdt_sticky_xml-0.12.27.tar.gz (137.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycrdt_sticky_xml-0.12.27-cp312-cp312-macosx_11_0_arm64.whl (814.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file pycrdt_sticky_xml-0.12.27.tar.gz.

File metadata

  • Download URL: pycrdt_sticky_xml-0.12.27.tar.gz
  • Upload date:
  • Size: 137.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for pycrdt_sticky_xml-0.12.27.tar.gz
Algorithm Hash digest
SHA256 e4b89b165a0d614be6c500ab8e70db61be4669ef90dfeeab3dc559769e0a33d5
MD5 86926f1041e56d2ca759ff67e0ad7d1e
BLAKE2b-256 a809fe93cebc7d138001a2c77788a8712d8d2872244b8dee20623eae562a2666

See more details on using hashes here.

File details

Details for the file pycrdt_sticky_xml-0.12.27-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pycrdt_sticky_xml-0.12.27-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8bef09f33e2950d22ef58543adf127c5acda2ef6d23e221c2b6ed86e50da51a7
MD5 62385fed3116da89159e3a601ed44781
BLAKE2b-256 fc665c6a5b02a9b9104581c5f65f4ab376e0045adfae66442f89c9371233fd04

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page