CLI tool to sync your Markdown to Leaflet
leafletpub atproto cli markdown
30
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix incorrect facet offsets with non-ASCII characters

SharpMars 8f059be2 a4b316a0

+5 -4
+5 -4
src/conversion.ts
··· 170 170 offset ??= 0; 171 171 parents ??= []; 172 172 let blocks: PubLeafletPagesLinearDocument.Block[] = []; 173 + const encoder = new TextEncoder("utf-8"); 173 174 174 175 for (const content of children) { 175 176 if (content.type == "text") { ··· 208 209 index: { 209 210 $type: "pub.leaflet.richtext.facet#byteSlice", 210 211 byteStart: offset, 211 - byteEnd: offset + content.value.length, 212 + byteEnd: offset + encoder.encode(content.value).length, 212 213 }, 213 214 }, 214 215 ...facets, 215 216 ]; 216 217 217 218 text += content.value; 218 - offset += content.value.length; 219 + offset += encoder.encode(content.value).length; 219 220 } else if (content.type == "break") { 220 221 blocks.push({ 221 222 $type: "pub.leaflet.pages.linearDocument#block", ··· 248 249 index: { 249 250 $type: "pub.leaflet.richtext.facet#byteSlice", 250 251 byteStart: offset, 251 - byteEnd: offset + content.value.length, 252 + byteEnd: offset + encoder.encode(content.value).length, 252 253 }, 253 254 features: [{ $type: "pub.leaflet.richtext.facet#code" }], 254 255 }, 255 256 ...facets, 256 257 ]; 257 258 text += content.value; 258 - offset += content.value.length; 259 + offset += encoder.encode(content.value).length; 259 260 } else if (content.type == "image") { 260 261 if (text != "") { 261 262 blocks.push({