···11+import { expect, test, describe } from 'vitest'
22+import { SiteStandardDocument } from '../src/standardizeToAtProto'
33+44+let markdownText = "> When I envision the web, I picture an infinite expanse of empty space that stretches as far as the eye can see. It's full of fertile soil, but no seeds have taken root. That is, except for about an acre of it.\n - Molly White, [We can have a different web](/noteworthy/we-can-have-a-different-web/)\n\nThe future of the internet seems up in the air. Consumed by rotting behemoths. What we have now is failing, but it is also part of our every-day life, our politics, our society, our communities and our friendships. All of those are at risk, in part because the ways we communicate are under attack. The fate of the open web is inextricable from the other ways our world is in crisis. \n\nWe face down a seemingly endless series of political, social, economic, and medical disasters on a melting planet. There is no doubt that the internet is deeply integrated into everything that is going both right and wrong.\n\nAt this moment, [we are actively discussing how to build a future for our shared global telecommunications network](https://aramzs.xyz/lists/a-future-for-the-web/). This is good. We need this discussion. We also need to acknowledge that the wide open platform for infinite data, innovation and communication isn't a shelter from the disaster, but it *is* at the heart of everything we do. The day we could go back from that, even if we wanted to, is long gone. That means [rewilding the web](https://www.noemamag.com/we-need-to-rewild-the-internet/) isn't **just** a matter of a better internet. Our way to a better web can't be purely technical. It's the matter of being part of the making of a better world. \n\nWith the problem so large, how do we approach a solution? If we want to plant a forest how do we grow the ground cover? \n\nDe-abstract. What is the internet really? It's wires, and waves (and occasionally, joking aside, [pipes](https://www.windsystemsmag.com/the-latest-advancements-in-submarine-cables-protection/)) all put to the purpose of connecting people to each other. \n\nThe internet then is the series of connections between [people](https://adactio.com/journal/18337), at a huge scale. Not everyone is connected to everyone, but if you're on the internet, you're connecting to *someone*. So it isn't so much a world wide web as it is world wide **webs**. \n\nThe future core of a [humane](https://humanewebmanifesto.com/) internet, if we are going to be able to use it to do the essential work of surviving this century, is a series of linked routes that stick us all together and supports our communities.\n\nI don't think there is only one solution, I couldn't possibly know them all, but I have one approach that has led me to launch this particular website (and [some others](/projects/)). \n\nThe thing about webs is [they are failure resistent, one strand falling won't take the whole thing down](https://news.mit.edu/2012/spider-web-strength-0202). You can punch a hole through them, but webs are also rebuilt regularly, they can fail and come back quickly. \n\nWe need to think of our connections and how we transmit information to each other in the same way. An important message should be able to travel edge to edge without interference and make it from web to web successfully. We need to think about *links*. Not just in the literal sense. We weave our communities together by establishing bedrocks of shared knowledge. \n\nI think what really put this into sharp focus for me is [the long death of Twitter](https://www.schizochronotopia.com/p/on-twitter-we-look-down). Twitter is still a platform where, for professional reasons, I'm quite active, but its biggest utility--directing me to information that I'm interested in or that is important to me--that's gone. \n\nWe need to rethink how amplification works without requiring big tech or even a steady internet connection. Here are three big assumptions sitting inside this larger question of how best to build our webs. \n\n1. Amplification through cross-linking between individual entities and feeds is essentially rejuvenating for the web. \n2. We [can't](https://ahrefs.com/blog/link-rot-study/) [take the life of those links for granted](https://www.pewresearch.org/data-labs/2024/05/17/when-online-content-disappears/) and an essential part of this rejuvenation process is archiving links that are important enough to amplify.\n3. In the current world [it is nearly impossible](https://www.nytimes.com/2020/07/31/technology/blocking-the-tech-giants.html) to build without touching or using the technology of a mega-corporation in some way so we should expect to build on things that will fail, enshittify, or rot, and need to be moved off from quickly.\n\n## To that end I've considered some principles for my own projects.\n\nThese (and the project of crafting them) are heavily inspired by [the IndieWeb principles](https://indieweb.org/principles). \n\n### Principles of Amplification for better webs\n\n- Aggregation is amplification.\n- In a post-Twitter world, reach requires coordination. \n- If it has to query a backend to load it will one day die. \n- Amplification is power, use it responsibly. \n- Massive replication of your own work is good. Massive aggregation between members of a community is even better. \n- [Amplification](/thoughts/using-amplify-as-a-type/) is a method to build community\n- You can always [check out](https://dataprivacymanager.net/what-is-data-subject-access-request-dsar/), copy, or scrape your work from other platforms and take ownership.\n\n### Principles of Archiving for better webs\n\n- Using the web downloads it to your computer, you should get to keep it for your personal use.\n- [Kill the app](https://tweets.aramzs.com/1390071898202120192/). They are black boxes filled with content and knowledge that will one day be lost forever.\n- Everyone should support the Internet Archive, but we [shouldn't](https://www.forbes.com/sites/mattnovak/2023/05/28/internet-archive-suffers-major-global-outage/) assume it is invulnerable. \n- Own your own archive. \n- Single points of failure are dangerous and, as an expected operating tool, destroy innovation.\n- Anything that can't fit on its own offline drive will die.\n\n### Principles of Web Weaving\n\n- Connecting to each other connects our audiences.\n- Curated connections form bridges out of the walled gardens that hurt us and our society. \n- Accept the rotting giant corporations that harvest human connections for profit, realize you must exist in their context to help others, and use their platforms and technology as a vaulting poll to bring yourself and others outside the walls.\n- The [baseline has shifted](/glossary/shifting-baselines/) away from an open web, but if we act like we are already in the future we want to build we can shift them again.\n\n## The Long Next\n\nWith these concepts in mind, I think of a lot of acronyms I've been considering as part of the future of the web: \n\n- [ESC](https://esc.fyi/) - End Surveillance Capitalism\n- [POSSE](https://indieweb.org/POSSE) - Publish (on your) Own Site, Syndicate Elsewhere\n- [PESOS](https://indieweb.org/PESOS) - Publish Elsewhere, Syndicate (to your) Own Site\n\nI want to add one more to the list. \n\nWe need to think about how to [ENTER](/glossary/enter/) the wild web.\n\n### Extract\n\nFor now it's [impossible to interact with others and move through this world without touching big tech](https://www.nytimes.com/2020/07/31/technology/blocking-the-tech-giants.html). With this in mind, we are all going to end up using some of those platforms. So what we need are methods to extract the data off those platforms. There are blunt ways like scraping, and potentially captured ways like platform APIs. However, thanks to the explosion of privacy and interoperability-related legislation around the world, [most sites have an option to check out all your data](https://dataprivacymanager.net/what-is-data-subject-access-request-dsar/). \n\nOnce you have reclaimed your own works, you can do all sorts of things with it. Eventually you can even leave the platform, delete everything, and take canonical status for that work with your own sites. [I'm just getting started](https://aramzs.xyz/tutorials/how-to-export-your-links-from-pocket/), but I plan on writing more about how to do this.\n\n### Nullify \n\nRedirect or cross link your own sites and platform over the big tech ones whenever possible. Once you've linked off a enshittified platform and brought someone out of the walled garden and into your web, it's important to give them ways to interact with the internet that don't just push them right back into the hands of big tech. Whenever possible, push readers to open and wild web alternatives. \n\nCreate sites and networks that aren't just informative, but also fun to explore. \n\n### Transform \n\nTake the posts you've checked out or otherwise extracted and turn them into something new and cool. Everything we post on social media platforms owned by big tech companies is limited by the business models and requirement to render ad targeting data. It shapes our participation in ways we aren't aware of. Once we free our *own* works from those platforms, take the time and effort to turn them into something cool and new, no longer limited by the constraints from inside the wall. \n\nOne of my main projects for this site is building tools for transforming data extractions from [Letterboxd](/lists/film-and-tv/), [Pocket](/amplify/), and [Kindle](/resources/quotes/).\n\n### Exchange \n\nBuild community though connecting. Link to other people, this is hardly a new idea, but it does seem to have fallen by the wayside at various periods of the social web. \n\nTruly fair exchanges between members of the (or a) web means more than that though, it means actively getting permission from others to remix their work and doing it. It means using and building on top of the work of others in all formats, not just code.\n\nIt also means: [copyleft](https://en.wikipedia.org/wiki/Copyleft) your work. The future of the web is not copyrighted. The future of the web is post-capitalism. Trying to play copyright games with big tech is a losing game, all we get is siloed culture that big tech steals anyway, either directly or in forms of aggregation or by bundling it into AI which spits it back out as plagiarism and bullshit. The future of the web isn't just open source code, it's [open creativity](https://adactio.com/articles/1522/). It's is [share and share alike](https://creativecommons.org/share-your-work/cclicenses/) to build, remix and replicate the best things on the internet. \n\n### Replicate \n\nWe should understand that there is no \"Long Now\". VCs, big clocks and big money are a fleeting phenomenon that is more likely to self-destruct or destroy us than it is to save us. The foundation of projects like The Long Now is built on the resources of people who think we need to maintain the present, scrolled out into an eternally status quo-maintaining future. \n\nLet me be blunt: The present isn't worth preserving. \n\nLet's think instead about **The Long Next**, a future where we build sustainably; live with the knowledge that [we can't be always-online](/resources/bookmarks/low-tech-magazine/); and consider a world that **we** sustain in our projects, groups and communities. The Long Next isn't about preserving wealth and capital long enough to catapult the rich to Mars, it is about holistic rewilding of the web, the Earth, the future. A world we can live in, not one we are going to sacrifice on the alter of wealthy egos. \n\nCentral archives are incredibly important, but they're also central points of failure, vulnerable not just to physical attacks, but to legal ones as well. Worse, it is at the mercy of big donors who have proved time and again that they'd rather burn the present to build their personal vision of the future than sustain it. It's hard to believe such people will forever consider supporting projects like The Internet Archive in their best interest, especially as they sit above companies whose works are focused on essentially in-housing that work *as a competitive advantage*. \n\nWe should continue to support big important archival projects. I think their work is amazing and deserves all our support to keep them going as long as we can. \n\nA long next, a sustainable future, means that we need to do more than that, we need to think about how to keep the archives of what is important to us close to home, replicate them across our local networks and retain their information in case of the worst. \n\nThe parts of the web that are most important to you should be available to you, even if the internet isn't.\n\nSo use your newly wild websites to preserve the parts of the web that matter to you. Host site-local archives with indicators that point back to and [300s](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_redirection) back to the originals. Keep the option to take them with you, or to drop redirects if they die so you'll have them *just in case*. Make sure to set up those local archives so they can be accessed by you, by others, and using your own search tools. [Submit](https://web.archive.org/save) [those](https://chromewebstore.google.com/detail/wayback-machine/fpnmgdkabkmnadcjpehmlllkndpkmiak) [links](https://archive.org/details/introduction-to-the-warc) [to](https://help.archive.org/help/uploading-a-basic-guide/) [The Internet Archive](https://help.archive.org/help/save-pages-in-the-wayback-machine/) at the same time. \n\n[Make sure what you build is easy for others to archive](https://jeffhuang.com/designed_to_last/).\n\n## The Future Soon \n\nThis is a summary. I think I could explore any one of these points more deeply and maybe I will. This is a good start at trying to describe what I want to do with this site and the other sites I'm working on.\n\nI think that working in public and thinking in public keeps me honest, so that's what I've got here. If it's interesting to you, maybe it is something you can explore as well, try to follow through with on your own websites. Increasingly I wish for a **zine-web** filled with tiny one-off websites and fun projects, a million well-tended webs intersecting with each other, and archived by their peers. \n\n\nWe can join our own little webs together. One thing is certain, making the web a better place isn't a project to undertake alone or in private. \n\n[Reach out on Mastodon to talk](https://indieweb.social/@Chronotope). \n\n~~\n\nSelected Responses: \n\n- [Don Marti](https://federate.social/@dmarti/112587045311696156)\n- I really like [the idea of bringing back Diskmags](https://elk.zone/indieweb.social/@teajaygrey@rap.social/112606872290801809). I was not familiar with the concept at all, but ended up [finding out about it when I researched the response](https://diskmags.de/index.php?title=Introduction) and I like the idea of removable media used as a potential model for a sometimes-on web. \n- There is [a really cool list of articles that talk about this topic of the future of a better web which you can check out](https://projects.kwon.nyc/internet-is-fun/). \n\n~~\n\nCover Image by <a href=\"https://commons.wikimedia.org/wiki/User:Chen-Pan_Liao\" title=\"User:Chen-Pan Liao\">Chen-Pan Liao</a> - <span class=\"int-own-work\" lang=\"en\">Own work</span>, <a href=\"https://creativecommons.org/licenses/by-sa/3.0\" title=\"Creative Commons Attribution-Share Alike 3.0\">CC BY-SA 3.0</a>, <a href=\"https://commons.wikimedia.org/w/index.php?curid=15926393\">Link</a>"
55+let plainText = "When I envision the web, I picture an infinite expanse of empty space that stretches as far as the eye can see. It's full of fertile soil, but no seeds have taken root. That is, except for about an acre of it.\nMolly White, We can have a different web\n\nThe future of the internet seems up in the air. Consumed by rotting behemoths. What we have now is failing, but it is also part of our every-day life, our politics, our society, our communities and our friendships. All of those are at risk, in part because the ways we communicate are under attack. The fate of the open web is inextricable from the other ways our world is in crisis.\n\nWe face down a seemingly endless series of political, social, economic, and medical disasters on a melting planet. There is no doubt that the internet is deeply integrated into everything that is going both right and wrong.\n\nAt this moment, we are actively discussing how to build a future for our shared global telecommunications network. This is good. We need this discussion. We also need to acknowledge that the wide open platform for infinite data, innovation and communication isn't a shelter from the disaster, but it is at the heart of everything we do. The day we could go back from that, even if we wanted to, is long gone. That means rewilding the web isn't just a matter of a better internet. Our way to a better web can't be purely technical. It's the matter of being part of the making of a better world.\n\nWith the problem so large, how do we approach a solution? If we want to plant a forest how do we grow the ground cover?\n\nDe-abstract. What is the internet really? It's wires, and waves (and occasionally, joking aside, pipes) all put to the purpose of connecting people to each other.\n\nThe internet then is the series of connections between people, at a huge scale. Not everyone is connected to everyone, but if you're on the internet, you're connecting to someone. So it isn't so much a world wide web as it is world wide webs.\n\nThe future core of a humane internet, if we are going to be able to use it to do the essential work of surviving this century, is a series of linked routes that stick us all together and supports our communities.\n\nI don't think there is only one solution, I couldn't possibly know them all, but I have one approach that has led me to launch this particular website (and some others).\n\nThe thing about webs is they are failure resistent, one strand falling won't take the whole thing down. You can punch a hole through them, but webs are also rebuilt regularly, they can fail and come back quickly.\n\nWe need to think of our connections and how we transmit information to each other in the same way. An important message should be able to travel edge to edge without interference and make it from web to web successfully. We need to think about links. Not just in the literal sense. We weave our communities together by establishing bedrocks of shared knowledge.\n\nI think what really put this into sharp focus for me is the long death of Twitter. Twitter is still a platform where, for professional reasons, I'm quite active, but its biggest utility--directing me to information that I'm interested in or that is important to me--that's gone.\n\nWe need to rethink how amplification works without requiring big tech or even a steady internet connection. Here are three big assumptions sitting inside this larger question of how best to build our webs.\nAmplification through cross-linking between individual entities and feeds is essentially rejuvenating for the web.\nWe can't take the life of those links for granted and an essential part of this rejuvenation process is archiving links that are important enough to amplify.\nIn the current world it is nearly impossible to build without touching or using the technology of a mega-corporation in some way so we should expect to build on things that will fail, enshittify, or rot, and need to be moved off from quickly.\n\nTo that end I've considered some principles for my own projects.\n\nThese (and the project of crafting them) are heavily inspired by the IndieWeb principles.\n\nPrinciples of Amplification for better webs\nAggregation is amplification.\nIn a post-Twitter world, reach requires coordination.\nIf it has to query a backend to load it will one day die.\nAmplification is power, use it responsibly.\nMassive replication of your own work is good. Massive aggregation between members of a community is even better.\nAmplification is a method to build community\nYou can always check out, copy, or scrape your work from other platforms and take ownership.\n\nPrinciples of Archiving for better webs\nUsing the web downloads it to your computer, you should get to keep it for your personal use.\nKill the app. They are black boxes filled with content and knowledge that will one day be lost forever.\nEveryone should support the Internet Archive, but we shouldn't assume it is invulnerable.\nOwn your own archive.\nSingle points of failure are dangerous and, as an expected operating tool, destroy innovation.\nAnything that can't fit on its own offline drive will die.\n\nPrinciples of Web Weaving\nConnecting to each other connects our audiences.\nCurated connections form bridges out of the walled gardens that hurt us and our society.\nAccept the rotting giant corporations that harvest human connections for profit, realize you must exist in their context to help others, and use their platforms and technology as a vaulting poll to bring yourself and others outside the walls.\nThe baseline has shifted away from an open web, but if we act like we are already in the future we want to build we can shift them again.\n\nThe Long Next\n\nWith these concepts in mind, I think of a lot of acronyms I've been considering as part of the future of the web:\nESC - End Surveillance Capitalism\nPOSSE - Publish (on your) Own Site, Syndicate Elsewhere\nPESOS - Publish Elsewhere, Syndicate (to your) Own Site\n\nI want to add one more to the list.\n\nWe need to think about how to ENTER the wild web.\n\nExtract\n\nFor now it's impossible to interact with others and move through this world without touching big tech. With this in mind, we are all going to end up using some of those platforms. So what we need are methods to extract the data off those platforms. There are blunt ways like scraping, and potentially captured ways like platform APIs. However, thanks to the explosion of privacy and interoperability-related legislation around the world, most sites have an option to check out all your data.\n\nOnce you have reclaimed your own works, you can do all sorts of things with it. Eventually you can even leave the platform, delete everything, and take canonical status for that work with your own sites. I'm just getting started, but I plan on writing more about how to do this.\n\nNullify\n\nRedirect or cross link your own sites and platform over the big tech ones whenever possible. Once you've linked off a enshittified platform and brought someone out of the walled garden and into your web, it's important to give them ways to interact with the internet that don't just push them right back into the hands of big tech. Whenever possible, push readers to open and wild web alternatives.\n\nCreate sites and networks that aren't just informative, but also fun to explore.\n\nTransform\n\nTake the posts you've checked out or otherwise extracted and turn them into something new and cool. Everything we post on social media platforms owned by big tech companies is limited by the business models and requirement to render ad targeting data. It shapes our participation in ways we aren't aware of. Once we free our own works from those platforms, take the time and effort to turn them into something cool and new, no longer limited by the constraints from inside the wall.\n\nOne of my main projects for this site is building tools for transforming data extractions from Letterboxd, Pocket, and Kindle.\n\nExchange\n\nBuild community though connecting. Link to other people, this is hardly a new idea, but it does seem to have fallen by the wayside at various periods of the social web.\n\nTruly fair exchanges between members of the (or a) web means more than that though, it means actively getting permission from others to remix their work and doing it. It means using and building on top of the work of others in all formats, not just code.\n\nIt also means: copyleft your work. The future of the web is not copyrighted. The future of the web is post-capitalism. Trying to play copyright games with big tech is a losing game, all we get is siloed culture that big tech steals anyway, either directly or in forms of aggregation or by bundling it into AI which spits it back out as plagiarism and bullshit. The future of the web isn't just open source code, it's open creativity. It's is share and share alike to build, remix and replicate the best things on the internet.\n\nReplicate\n\nWe should understand that there is no \"Long Now\". VCs, big clocks and big money are a fleeting phenomenon that is more likely to self-destruct or destroy us than it is to save us. The foundation of projects like The Long Now is built on the resources of people who think we need to maintain the present, scrolled out into an eternally status quo-maintaining future.\n\nLet me be blunt: The present isn't worth preserving.\n\nLet's think instead about The Long Next, a future where we build sustainably; live with the knowledge that we can't be always-online; and consider a world that we sustain in our projects, groups and communities. The Long Next isn't about preserving wealth and capital long enough to catapult the rich to Mars, it is about holistic rewilding of the web, the Earth, the future. A world we can live in, not one we are going to sacrifice on the alter of wealthy egos.\n\nCentral archives are incredibly important, but they're also central points of failure, vulnerable not just to physical attacks, but to legal ones as well. Worse, it is at the mercy of big donors who have proved time and again that they'd rather burn the present to build their personal vision of the future than sustain it. It's hard to believe such people will forever consider supporting projects like The Internet Archive in their best interest, especially as they sit above companies whose works are focused on essentially in-housing that work as a competitive advantage.\n\nWe should continue to support big important archival projects. I think their work is amazing and deserves all our support to keep them going as long as we can.\n\nA long next, a sustainable future, means that we need to do more than that, we need to think about how to keep the archives of what is important to us close to home, replicate them across our local networks and retain their information in case of the worst.\n\nThe parts of the web that are most important to you should be available to you, even if the internet isn't.\n\nSo use your newly wild websites to preserve the parts of the web that matter to you. Host site-local archives with indicators that point back to and 300s back to the originals. Keep the option to take them with you, or to drop redirects if they die so you'll have them just in case. Make sure to set up those local archives so they can be accessed by you, by others, and using your own search tools. Submit those links to The Internet Archive at the same time.\n\nMake sure what you build is easy for others to archive.\n\nThe Future Soon\n\nThis is a summary. I think I could explore any one of these points more deeply and maybe I will. This is a good start at trying to describe what I want to do with this site and the other sites I'm working on.\n\nI think that working in public and thinking in public keeps me honest, so that's what I've got here. If it's interesting to you, maybe it is something you can explore as well, try to follow through with on your own websites. Increasingly I wish for a zine-web filled with tiny one-off websites and fun projects, a million well-tended webs intersecting with each other, and archived by their peers.\n\nWe can join our own little webs together. One thing is certain, making the web a better place isn't a project to undertake alone or in private.\n\nReach out on Mastodon to talk.\n\n~~\n\nSelected Responses:\nDon Marti\nI really like the idea of bringing back Diskmags. I was not familiar with the concept at all, but ended up finding out about it when I researched the response and I like the idea of removable media used as a potential model for a sometimes-on web.\nThere is a really cool list of articles that talk about this topic of the future of a better web which you can check out.\n\n~~\n\nCover Image by Chen-Pan Liao - Own work, CC BY-SA 3.0, Link"
66+77+describe('SiteStandardDocument', () => {
88+ // Test basic instantiation
99+ test('should create a document with required fields', () => {
1010+ const doc = new SiteStandardDocument({
1111+ site: 'https://example.com',
1212+ path: '/my-post',
1313+ title: 'Test Title',
1414+ description: 'Test description',
1515+ markdownContent: '# Hello World',
1616+ publishedAt: new Date('2024-01-01'),
1717+ updatedAt: new Date('2024-01-02'),
1818+ tags: ['test', 'example']
1919+ });
2020+2121+ expect(doc.$type).toBe('site.standard.document');
2222+ expect(doc.site).toBe('https://example.com');
2323+ expect(doc.path).toBe('/my-post');
2424+ expect(doc.title).toBe('Test Title');
2525+ expect(doc.description).toBe('Test description');
2626+ expect(doc.tags).toEqual(['test', 'example']);
2727+ });
2828+2929+ test('should accept at:// protocol URLs', () => {
3030+ const doc = new SiteStandardDocument({
3131+ site: 'at://did:plc:abc123',
3232+ path: '/post',
3333+ title: 'AT Protocol Post',
3434+ description: 'A post on AT Protocol',
3535+ markdownContent: 'Content',
3636+ publishedAt: new Date(),
3737+ updatedAt: new Date(),
3838+ tags: []
3939+ });
4040+4141+ expect(doc.site).toBe('at://did:plc:abc123');
4242+ });
4343+4444+ // Test markdown conversion
4545+ test('should convert markdown to content object', () => {
4646+ const markdown = '# Title\n\nThis is content.';
4747+ const doc = new SiteStandardDocument({
4848+ site: 'https://example.com',
4949+ path: '/post',
5050+ title: 'Title',
5151+ description: 'Description',
5252+ markdownContent: markdown,
5353+ publishedAt: new Date(),
5454+ updatedAt: new Date(),
5555+ tags: []
5656+ });
5757+5858+ expect(doc.content).toEqual({
5959+ $type: 'site.standard.content.markdown',
6060+ text: markdown,
6161+ version: '1.0'
6262+ });
6363+ });
6464+6565+ test('should use provided content object instead of generating from markdown', () => {
6666+ const customContent = {
6767+ $type: 'site.standard.content.html',
6868+ text: '<h1>HTML Content</h1>',
6969+ version: '2.0'
7070+ };
7171+7272+ const doc = new SiteStandardDocument({
7373+ site: 'https://example.com',
7474+ path: '/post',
7575+ title: 'Title',
7676+ description: 'Description',
7777+ markdownContent: '# Markdown',
7878+ publishedAt: new Date(),
7979+ updatedAt: new Date(),
8080+ tags: [],
8181+ content: customContent
8282+ });
8383+8484+ expect(doc.content).toEqual(customContent);
8585+ });
8686+8787+ // Test optional fields
8888+ test('should handle optional rkey field', () => {
8989+ const doc = new SiteStandardDocument({
9090+ site: 'https://example.com',
9191+ path: '/post',
9292+ title: 'Title',
9393+ description: 'Description',
9494+ markdownContent: 'Content',
9595+ publishedAt: new Date(),
9696+ updatedAt: new Date(),
9797+ tags: [],
9898+ rkey: 'custom-rkey-123'
9999+ });
100100+101101+ expect(doc.rkey).toBe('custom-rkey-123');
102102+ });
103103+104104+ test('should handle optional coverImage field', () => {
105105+ const coverImage = {
106106+ $type: 'blob' as const,
107107+ ref: { $link: 'bafyrei...' },
108108+ mimeType: 'image/jpeg' as any
109109+ };
110110+111111+ const doc = new SiteStandardDocument({
112112+ site: 'https://example.com',
113113+ path: '/post',
114114+ title: 'Title',
115115+ description: 'Description',
116116+ markdownContent: 'Content',
117117+ publishedAt: new Date(),
118118+ updatedAt: new Date(),
119119+ tags: [],
120120+ coverImage
121121+ });
122122+123123+ expect(doc.coverImage).toEqual(coverImage);
124124+ });
125125+126126+ test('should handle optional bskyPostRef field', () => {
127127+ const bskyPostRef = {
128128+ $type: 'com.atproto.repo.strongRef' as const,
129129+ uri: 'at://did:plc:abc123' as const,
130130+ cid: 'bafyrei123'
131131+ };
132132+133133+ const doc = new SiteStandardDocument({
134134+ site: 'https://example.com',
135135+ path: '/post',
136136+ title: 'Title',
137137+ description: 'Description',
138138+ markdownContent: 'Content',
139139+ publishedAt: new Date(),
140140+ updatedAt: new Date(),
141141+ tags: [],
142142+ bskyPostRef
143143+ });
144144+145145+ expect(doc.bskyPostRef).toEqual(bskyPostRef);
146146+ });
147147+148148+ // Test content update methods
149149+ test('should update content and timestamp', () => {
150150+ const doc = new SiteStandardDocument({
151151+ site: 'https://example.com',
152152+ path: '/post',
153153+ title: 'Title',
154154+ description: 'Description',
155155+ markdownContent: 'Original content',
156156+ publishedAt: new Date('2024-01-01'),
157157+ updatedAt: new Date('2024-01-01'),
158158+ tags: []
159159+ });
160160+161161+ const originalUpdatedAt = doc.updatedAt;
162162+163163+ // Wait a tiny bit to ensure timestamp changes
164164+ setTimeout(() => {
165165+ doc.updateContent('New content');
166166+167167+ expect(doc.content.text).toBe('New content');
168168+ expect(doc.textContent).toBe('New content');
169169+ expect(doc.updatedAt.getTime()).toBeGreaterThan(originalUpdatedAt.getTime());
170170+ }, 10);
171171+ });
172172+173173+ // Test tag management
174174+ test('should add tags', () => {
175175+ const doc = new SiteStandardDocument({
176176+ site: 'https://example.com',
177177+ path: '/post',
178178+ title: 'Title',
179179+ description: 'Description',
180180+ markdownContent: 'Content',
181181+ publishedAt: new Date(),
182182+ updatedAt: new Date(),
183183+ tags: ['existing']
184184+ });
185185+186186+ doc.addTag('new-tag');
187187+ expect(doc.tags).toContain('new-tag');
188188+ expect(doc.tags).toContain('existing');
189189+ });
190190+191191+ test('should not add duplicate tags', () => {
192192+ const doc = new SiteStandardDocument({
193193+ site: 'https://example.com',
194194+ path: '/post',
195195+ title: 'Title',
196196+ description: 'Description',
197197+ markdownContent: 'Content',
198198+ publishedAt: new Date(),
199199+ updatedAt: new Date(),
200200+ tags: ['existing']
201201+ });
202202+203203+ doc.addTag('existing');
204204+ expect(doc.tags.filter(t => t === 'existing')).toHaveLength(1);
205205+ });
206206+207207+ test('should remove tags', () => {
208208+ const doc = new SiteStandardDocument({
209209+ site: 'https://example.com',
210210+ path: '/post',
211211+ title: 'Title',
212212+ description: 'Description',
213213+ markdownContent: 'Content',
214214+ publishedAt: new Date(),
215215+ updatedAt: new Date(),
216216+ tags: ['tag1', 'tag2', 'tag3']
217217+ });
218218+219219+ doc.removeTag('tag2');
220220+ expect(doc.tags).toEqual(['tag1', 'tag3']);
221221+ });
222222+223223+ // Test exportForMarkdown
224224+ test('should export minimal markdown metadata', () => {
225225+ const doc = new SiteStandardDocument({
226226+ site: 'https://example.com',
227227+ path: '/post',
228228+ title: 'Title',
229229+ description: 'Description',
230230+ markdownContent: 'Content',
231231+ publishedAt: new Date(),
232232+ updatedAt: new Date(),
233233+ tags: []
234234+ });
235235+236236+ const exported = doc.exportForMarkdown();
237237+ expect(exported).toEqual({
238238+ site: 'https://example.com'
239239+ });
240240+ });
241241+242242+ test('should export markdown metadata with optional fields', () => {
243243+ const doc = new SiteStandardDocument({
244244+ site: 'https://example.com',
245245+ path: '/post',
246246+ title: 'Title',
247247+ description: 'Description',
248248+ markdownContent: 'Content',
249249+ publishedAt: new Date(),
250250+ updatedAt: new Date(),
251251+ tags: [],
252252+ rkey: 'test-rkey',
253253+ coverImage: {
254254+ $type: 'blob' as const,
255255+ ref: { $link: 'bafyrei...' },
256256+ mimeType: 'image/png' as any
257257+ },
258258+ bskyPostRef: {
259259+ $type: 'com.atproto.repo.strongRef' as const,
260260+ uri: 'at://did:plc:abc123' as const,
261261+ cid: 'bafyrei123'
262262+ }
263263+ });
264264+265265+ const exported = doc.exportForMarkdown();
266266+ expect(exported.site).toBe('https://example.com');
267267+ expect(exported.rkey).toBe('test-rkey');
268268+ expect(exported.coverBlob).toBe('bafyrei...');
269269+ expect(exported.bskyPostRef).toBeDefined();
270270+ });
271271+272272+ // Test exportToAtProto
273273+ test('should export to AT Protocol format with required fields', () => {
274274+ const publishedAt = new Date('2024-01-01T12:00:00Z');
275275+ const updatedAt = new Date('2024-01-02T12:00:00Z');
276276+277277+ const doc = new SiteStandardDocument({
278278+ site: 'https://example.com',
279279+ path: '/post',
280280+ title: 'Title',
281281+ description: 'Description',
282282+ markdownContent: 'Content',
283283+ publishedAt,
284284+ updatedAt,
285285+ tags: ['tag1', 'tag2']
286286+ });
287287+288288+ const exported = doc.exportToAtProto();
289289+290290+ expect(exported.$type).toBe('site.standard.document');
291291+ expect(exported.site).toBe('https://example.com');
292292+ expect(exported.path).toBe('/post');
293293+ expect(exported.title).toBe('Title');
294294+ expect(exported.description).toBe('Description');
295295+ expect(exported.publishedAt).toBe(publishedAt.toISOString());
296296+ expect(exported.updatedAt).toBe(updatedAt.toISOString());
297297+ expect(exported.tags).toEqual(['tag1', 'tag2']);
298298+ });
299299+300300+ test('should enforce title maxLength constraint', () => {
301301+ const longTitle = 'a'.repeat(6000);
302302+ const doc = new SiteStandardDocument({
303303+ site: 'https://example.com',
304304+ path: '/post',
305305+ title: longTitle,
306306+ description: 'Description',
307307+ markdownContent: 'Content',
308308+ publishedAt: new Date(),
309309+ updatedAt: new Date(),
310310+ tags: []
311311+ });
312312+313313+ const exported = doc.exportToAtProto();
314314+ expect(exported.title).toHaveLength(5000);
315315+ });
316316+317317+ test('should enforce description maxLength constraint', () => {
318318+ const longDescription = 'a'.repeat(35000);
319319+ const doc = new SiteStandardDocument({
320320+ site: 'https://example.com',
321321+ path: '/post',
322322+ title: 'Title',
323323+ description: longDescription,
324324+ markdownContent: 'Content',
325325+ publishedAt: new Date(),
326326+ updatedAt: new Date(),
327327+ tags: []
328328+ });
329329+330330+ const exported = doc.exportToAtProto();
331331+ expect(exported.description).toHaveLength(30000);
332332+ });
333333+334334+ test('should enforce tag maxLength constraint', () => {
335335+ const longTag = 'a'.repeat(200);
336336+ const doc = new SiteStandardDocument({
337337+ site: 'https://example.com',
338338+ path: '/post',
339339+ title: 'Title',
340340+ description: 'Description',
341341+ markdownContent: 'Content',
342342+ publishedAt: new Date(),
343343+ updatedAt: new Date(),
344344+ tags: [longTag, 'normal-tag']
345345+ });
346346+347347+ const exported = doc.exportToAtProto();
348348+ expect(exported.tags[0]).toHaveLength(128);
349349+ expect(exported.tags[1]).toBe('normal-tag');
350350+ });
351351+352352+ test('should include optional fields in AT Proto export', () => {
353353+ const doc = new SiteStandardDocument({
354354+ site: 'https://example.com',
355355+ path: '/post',
356356+ title: 'Title',
357357+ description: 'Description',
358358+ markdownContent: 'Content',
359359+ publishedAt: new Date(),
360360+ updatedAt: new Date(),
361361+ tags: [],
362362+ coverImage: {
363363+ $type: 'blob' as const,
364364+ ref: { $link: 'bafyrei...' },
365365+ mimeType: 'image/jpeg' as any
366366+ },
367367+ bskyPostRef: {
368368+ $type: 'com.atproto.repo.strongRef' as const,
369369+ uri: 'at://did:plc:abc123' as const,
370370+ cid: 'bafyrei123'
371371+ }
372372+ });
373373+374374+ const exported = doc.exportToAtProto();
375375+ expect(exported.coverImage).toBeDefined();
376376+ expect(exported.bskyPostRef).toBeDefined();
377377+ });
378378+379379+ test('should not include updatedAt if not provided', () => {
380380+ const doc = new SiteStandardDocument({
381381+ site: 'https://example.com',
382382+ path: '/post',
383383+ title: 'Title',
384384+ description: 'Description',
385385+ markdownContent: 'Content',
386386+ publishedAt: new Date(),
387387+ updatedAt: new Date(),
388388+ tags: []
389389+ });
390390+391391+ // Manually remove updatedAt
392392+ doc.updatedAt = undefined as any;
393393+394394+ const exported = doc.exportToAtProto();
395395+ expect(exported.updatedAt).toBeUndefined();
396396+ });
397397+398398+ test('should update the bskyPostRef correctly', () => {
399399+ const doc = new SiteStandardDocument({
400400+ site: 'https://example.com',
401401+ path: '/post',
402402+ title: 'Title',
403403+ description: 'Description',
404404+ markdownContent: 'Content',
405405+ publishedAt: new Date(),
406406+ updatedAt: new Date(),
407407+ bskyPostRef: {
408408+ uri: 'at://did:plc:abc123',
409409+ cid: 'bafyrei123'
410410+ },
411411+ tags: []
412412+ });
413413+ expect(doc.bskyPostRef).toBeDefined();
414414+ expect(doc.bskyPostRef).toEqual({
415415+ "$type": "com.atproto.repo.strongRef",
416416+ "uri": "at://did:plc:abc123",
417417+ "cid": "bafyrei123"
418418+ });
419419+420420+ });
421421+ test('process markdown content to plain text', () => {
422422+ const doc = new SiteStandardDocument({
423423+ site: 'https://example.com',
424424+ path: '/post',
425425+ title: 'Title',
426426+ description: 'Description',
427427+ markdownContent: markdownText,
428428+ publishedAt: new Date(),
429429+ updatedAt: new Date(),
430430+ bskyPostRef: {
431431+ uri: 'at://did:plc:abc123',
432432+ cid: 'bafyrei123'
433433+ },
434434+ tags: []
435435+ });
436436+ expect(doc.textContent).toBeDefined();
437437+ expect(doc.textContent).toEqual(plainText);
438438+ });
439439+});
···1616 "mimeType": "image/jpeg",
1717 "size": 347901
1818 },
1919- "textContent": "When I envision the web, I picture an infinite expanse of empty space that stretches as far as the eye can see. It's full of fertile soil, but no seeds have taken root. That is, except for about an acre of it.\n\n - Molly White, We can have a different web\nThe future of the internet seems up in the air. Consumed by rotting behemoths. What we have now is failing, but it is also part of our every-day life, our politics, our society, our communities and our friendships. All of those are at risk, in part because the ways we communicate are under attack. The fate of the open web is inextricable from the other ways our world is in crisis.\n\nWe face down a seemingly endless series of political, social, economic, and medical disasters on a melting planet. There is no doubt that the internet is deeply integrated into everything that is going both right and wrong.\n\nAt this moment, we are actively discussing how to build a future for our shared global telecommunications network. This is good. We need this discussion. We also need to acknowledge that the wide open platform for infinite data, innovation and communication isn't a shelter from the disaster, but it is at the heart of everything we do. The day we could go back from that, even if we wanted to, is long gone. That means rewilding the web isn't just a matter of a better internet. Our way to a better web can't be purely technical. It's the matter of being part of the making of a better world.\n\nWith the problem so large, how do we approach a solution? If we want to plant a forest how do we grow the ground cover?\n\nDe-abstract. What is the internet really? It's wires, and waves (and occasionally, joking aside, pipes) all put to the purpose of connecting people to each other.\n\nThe internet then is the series of connections between people, at a huge scale. Not everyone is connected to everyone, but if you're on the internet, you're connecting to someone. So it isn't so much a world wide web as it is world wide webs.\n\nThe future core of a humane internet, if we are going to be able to use it to do the essential work of surviving this century, is a series of linked routes that stick us all together and supports our communities.\n\nI don't think there is only one solution, I couldn't possibly know them all, but I have one approach that has led me to launch this particular website (and some others).\n\nThe thing about webs is they are failure resistent, one strand falling won't take the whole thing down. You can punch a hole through them, but webs are also rebuilt regularly, they can fail and come back quickly.\n\nWe need to think of our connections and how we transmit information to each other in the same way. An important message should be able to travel edge to edge without interference and make it from web to web successfully. We need to think about links. Not just in the literal sense. We weave our communities together by establishing bedrocks of shared knowledge.\n\nI think what really put this into sharp focus for me is the long death of Twitter. Twitter is still a platform where, for professional reasons, I'm quite active, but its biggest utility--directing me to information that I'm interested in or that is important to me--that's gone.\n\nWe need to rethink how amplification works without requiring big tech or even a steady internet connection. Here are three big assumptions sitting inside this larger question of how best to build our webs.\n\nAmplification through cross-linking between individual entities and feeds is essentially rejuvenating for the web.\nWe can't take the life of those links for granted and an essential part of this rejuvenation process is archiving links that are important enough to amplify.\nIn the current world it is nearly impossible to build without touching or using the technology of a mega-corporation in some way so we should expect to build on things that will fail, enshittify, or rot, and need to be moved off from quickly.\nTo that end I've considered some principles for my own projects.\nThese (and the project of crafting them) are heavily inspired by the IndieWeb principles.\n\nPrinciples of Amplification for better webs\nAggregation is amplification.\nIn a post-Twitter world, reach requires coordination.\nIf it has to query a backend to load it will one day die.\nAmplification is power, use it responsibly.\nMassive replication of your own work is good. Massive aggregation between members of a community is even better.\nAmplification is a method to build community\nYou can always check out, copy, or scrape your work from other platforms and take ownership.\nPrinciples of Archiving for better webs\nUsing the web downloads it to your computer, you should get to keep it for your personal use.\nKill the app. They are black boxes filled with content and knowledge that will one day be lost forever.\nEveryone should support the Internet Archive, but we shouldn't assume it is invulnerable.\nOwn your own archive.\nSingle points of failure are dangerous and, as an expected operating tool, destroy innovation.\nAnything that can't fit on its own offline drive will die.\nPrinciples of Web Weaving\nConnecting to each other connects our audiences.\nCurated connections form bridges out of the walled gardens that hurt us and our society.\nAccept the rotting giant corporations that harvest human connections for profit, realize you must exist in their context to help others, and use their platforms and technology as a vaulting poll to bring yourself and others outside the walls.\nThe baseline has shifted away from an open web, but if we act like we are already in the future we want to build we can shift them again.\nThe Long Next\nWith these concepts in mind, I think of a lot of acronyms I've been considering as part of the future of the web:\n\nESC - End Surveillance Capitalism\nPOSSE - Publish (on your) Own Site, Syndicate Elsewhere\nPESOS - Publish Elsewhere, Syndicate (to your) Own Site\nI want to add one more to the list.\n\nWe need to think about how to ENTER the wild web.\n\nExtract\nFor now it's impossible to interact with others and move through this world without touching big tech. With this in mind, we are all going to end up using some of those platforms. So what we need are methods to extract the data off those platforms. There are blunt ways like scraping, and potentially captured ways like platform APIs. However, thanks to the explosion of privacy and interoperability-related legislation around the world, most sites have an option to check out all your data.\n\nOnce you have reclaimed your own works, you can do all sorts of things with it. Eventually you can even leave the platform, delete everything, and take canonical status for that work with your own sites. I'm just getting started, but I plan on writing more about how to do this.\n\nNullify\nRedirect or cross link your own sites and platform over the big tech ones whenever possible. Once you've linked off a enshittified platform and brought someone out of the walled garden and into your web, it's important to give them ways to interact with the internet that don't just push them right back into the hands of big tech. Whenever possible, push readers to open and wild web alternatives.\n\nCreate sites and networks that aren't just informative, but also fun to explore.\n\nTransform\nTake the posts you've checked out or otherwise extracted and turn them into something new and cool. Everything we post on social media platforms owned by big tech companies is limited by the business models and requirement to render ad targeting data. It shapes our participation in ways we aren't aware of. Once we free our own works from those platforms, take the time and effort to turn them into something cool and new, no longer limited by the constraints from inside the wall.\n\nOne of my main projects for this site is building tools for transforming data extractions from Letterboxd, Pocket, and Kindle.\n\nExchange\nBuild community though connecting. Link to other people, this is hardly a new idea, but it does seem to have fallen by the wayside at various periods of the social web.\n\nTruly fair exchanges between members of the (or a) web means more than that though, it means actively getting permission from others to remix their work and doing it. It means using and building on top of the work of others in all formats, not just code.\n\nIt also means: copyleft your work. The future of the web is not copyrighted. The future of the web is post-capitalism. Trying to play copyright games with big tech is a losing game, all we get is siloed culture that big tech steals anyway, either directly or in forms of aggregation or by bundling it into AI which spits it back out as plagiarism and bullshit. The future of the web isn't just open source code, it's open creativity. It's is share and share alike to build, remix and replicate the best things on the internet.\n\nReplicate\nWe should understand that there is no \"Long Now\". VCs, big clocks and big money are a fleeting phenomenon that is more likely to self-destruct or destroy us than it is to save us. The foundation of projects like The Long Now is built on the resources of people who think we need to maintain the present, scrolled out into an eternally status quo-maintaining future.\n\nLet me be blunt: The present isn't worth preserving.\n\nLet's think instead about The Long Next, a future where we build sustainably; live with the knowledge that we can't be always-online; and consider a world that we sustain in our projects, groups and communities. The Long Next isn't about preserving wealth and capital long enough to catapult the rich to Mars, it is about holistic rewilding of the web, the Earth, the future. A world we can live in, not one we are going to sacrifice on the alter of wealthy egos.\n\nCentral archives are incredibly important, but they're also central points of failure, vulnerable not just to physical attacks, but to legal ones as well. Worse, it is at the mercy of big donors who have proved time and again that they'd rather burn the present to build their personal vision of the future than sustain it. It's hard to believe such people will forever consider supporting projects like The Internet Archive in their best interest, especially as they sit above companies whose works are focused on essentially in-housing that work as a competitive advantage.\n\nWe should continue to support big important archival projects. I think their work is amazing and deserves all our support to keep them going as long as we can.\n\nA long next, a sustainable future, means that we need to do more than that, we need to think about how to keep the archives of what is important to us close to home, replicate them across our local networks and retain their information in case of the worst.\n\nThe parts of the web that are most important to you should be available to you, even if the internet isn't.\n\nSo use your newly wild websites to preserve the parts of the web that matter to you. Host site-local archives with indicators that point back to and 300s back to the originals. Keep the option to take them with you, or to drop redirects if they die so you'll have them just in case. Make sure to set up those local archives so they can be accessed by you, by others, and using your own search tools. Submit those links to The Internet Archive at the same time.\n\nMake sure what you build is easy for others to archive.\n\nThe Future Soon\nThis is a summary. I think I could explore any one of these points more deeply and maybe I will. This is a good start at trying to describe what I want to do with this site and the other sites I'm working on.\n\nI think that working in public and thinking in public keeps me honest, so that's what I've got here. If it's interesting to you, maybe it is something you can explore as well, try to follow through with on your own websites. Increasingly I wish for a zine-web filled with tiny one-off websites and fun projects, a million well-tended webs intersecting with each other, and archived by their peers.\n\nWe can join our own little webs together. One thing is certain, making the web a better place isn't a project to undertake alone or in private.\n\nReach out on Mastodon to talk.\n\n~~\n\nSelected Responses:\n\nDon Marti\nI really like the idea of bringing back Diskmags. I was not familiar with the concept at all, but ended up finding out about it when I researched the response and I like the idea of removable media used as a potential model for a sometimes-on web.\nThere is a really cool list of articles that talk about this topic of the future of a better web which you can check out.",
1919+ "textContent": "When I envision the web, I picture an infinite expanse of empty space that stretches as far as the eye can see. It's full of fertile soil, but no seeds have taken root. That is, except for about an acre of it.\n\n - Molly White, We can have a different web\nThe future of the internet seems up in the air. Consumed by rotting behemoths. What we have now is failing, but it is also part of our every-day life, our politics, our society, our communities and our friendships. All of those are at risk, in part because the ways we communicate are under attack. The fate of the open web is inextricable from the other ways our world is in crisis.\n\nWe face down a seemingly endless series of political, social, economic, and medical disasters on a melting planet. There is no doubt that the internet is deeply integrated into everything that is going both right and wrong.\n\nAt this moment, we are actively discussing how to build a future for our shared global telecommunications network. This is good. We need this discussion. We also need to acknowledge that the wide open platform for infinite data, innovation and communication isn't a shelter from the disaster, but it is at the heart of everything we do. The day we could go back from that, even if we wanted to, is long gone. That means rewilding the web isn't just a matter of a better internet. Our way to a better web can't be purely technical. It's the matter of being part of the making of a better world.\n\nWith the problem so large, how do we approach a solution? If we want to plant a forest how do we grow the ground cover?\n\nDe-abstract. What is the internet really? It's wires, and waves (and occasionally, joking aside, pipes) all put to the purpose of connecting people to each other.\n\nThe internet then is the series of connections between people, at a huge scale. Not everyone is connected to everyone, but if you're on the internet, you're connecting to someone. So it isn't so much a world wide web as it is world wide webs.\n\nThe future core of a humane internet, if we are going to be able to use it to do the essential work of surviving this century, is a series of linked routes that stick us all together and supports our communities.\n\nI don't think there is only one solution, I couldn't possibly know them all, but I have one approach that has led me to launch this particular website (and some others).\n\nThe thing about webs is they are failure resistent, one strand falling won't take the whole thing down. You can punch a hole through them, but webs are also rebuilt regularly, they can fail and come back quickly.\n\nWe need to think of our connections and how we transmit information to each other in the same way. An important message should be able to travel edge to edge without interference and make it from web to web successfully. We need to think about links. Not just in the literal sense. We weave our communities together by establishing bedrocks of shared knowledge.\n\nI think what really put this into sharp focus for me is the long death of Twitter. Twitter is still a platform where, for professional reasons, I'm quite active, but its biggest utility--directing me to information that I'm interested in or that is important to me--that's gone.\n\nWe need to rethink how amplification works without requiring big tech or even a steady internet connection. Here are three big assumptions sitting inside this larger question of how best to build our webs.\n\nAmplification through cross-linking between individual entities and feeds is essentially rejuvenating for the web.\nWe can't take the life of those links for granted and an essential part of this rejuvenation process is archiving links that are important enough to amplify.\nIn the current world it is nearly impossible to build without touching or using the technology of a mega-corporation in some way so we should expect to build on things that will fail, enshittify, or rot, and need to be moved off from quickly.\nTo that end I've considered some principles for my own projects.\nThese (and the project of crafting them) are heavily inspired by the IndieWeb principles.\n\nPrinciples of Amplification for better webs\nAggregation is amplification.\nIn a post-Twitter world, reach requires coordination.\nIf it has to query a backend to load it will one day die.\nAmplification is power, use it responsibly.\nMassive replication of your own work is good. Massive aggregation between members of a community is even better.\nAmplification is a method to build community\nYou can always check out, copy, or scrape your work from other platforms and take ownership.\nPrinciples of Archiving for better webs\nUsing the web downloads it to your computer, you should get to keep it for your personal use.\nKill the app. They are black boxes filled with content and knowledge that will one day be lost forever.\nEveryone should support the Internet Archive, but we shouldn't assume it is invulnerable.\nOwn your own archive.\nSingle points of failure are dangerous and, as an expected operating tool, destroy innovation.\nAnything that can't fit on its own offline drive will die.\nPrinciples of Web Weaving\nConnecting to each other connects our audiences.\nCurated connections form bridges out of the walled gardens that hurt us and our society.\nAccept the rotting giant corporations that harvest human connections for profit, realize you must exist in their context to help others, and use their platforms and technology as a vaulting poll to bring yourself and others outside the walls.\nThe baseline has shifted away from an open web, but if we act like we are already in the future we want to build we can shift them again.\nThe Long Next\nWith these concepts in mind, I think of a lot of acronyms I've been considering as part of the future of the web:\n\nESC - End Surveillance Capitalism\nPOSSE - Publish (on your) Own Site, Syndicate Elsewhere\nPESOS - Publish Elsewhere, Syndicate (to your) Own Site\nI want to add one more to the list.\n\nWe need to think about how to ENTER the wild web.\n\nExtract\nFor now it's impossible to interact with others and move through this world without touching big tech. With this in mind, we are all going to end up using some of those platforms. So what we need are methods to extract the data off those platforms. There are blunt ways like scraping, and potentially captured ways like platform APIs. However, thanks to the explosion of privacy and interoperability-related legislation around the world, most sites have an option to check out all your data.\n\nOnce you have reclaimed your own works, you can do all sorts of things with it. Eventually you can even leave the platform, delete everything, and take canonical status for that work with your own sites. I'm just getting started, but I plan on writing more about how to do this.\n\nNullify\nRedirect or cross link your own sites and platform over the big tech ones whenever possible. Once you've linked off a enshittified platform and brought someone out of the walled garden and into your web, it's important to give them ways to interact with the internet that don't just push them right back into the hands of big tech. Whenever possible, push readers to open and wild web alternatives.\n\nCreate sites and networks that aren't just informative, but also fun to explore.\n\nTransform\nTake the posts you've checked out or otherwise extracted and turn them into something new and cool. Everything we post on social media platforms owned by big tech companies is limited by the business models and requirement to render ad targeting data. It shapes our participation in ways we aren't aware of. Once we free our own works from those platforms, take the time and effort to turn them into something cool and new, no longer limited by the constraints from inside the wall.\n\nOne of my main projects for this site is building tools for transforming data extractions from [Letterboxd](/lists/film-and-tv/), [Pocket](/amplify/), and [Kindle](/resources/quotes/).\n\nExchange\nBuild community though connecting. Link to other people, this is hardly a new idea, but it does seem to have fallen by the wayside at various periods of the social web.\n\nTruly fair exchanges between members of the (or a) web means more than that though, it means actively getting permission from others to remix their work and doing it. It means using and building on top of the work of others in all formats, not just code.\n\nIt also means: [copyleft](https://en.wikipedia.org/wiki/Copyleft) your work. The future of the web is not copyrighted. The future of the web is post-capitalism. Trying to play copyright games with big tech is a losing game, all we get is siloed culture that big tech steals anyway, either directly or in forms of aggregation or by bundling it into AI which spits it back out as plagiarism and bullshit. The future of the web isn't just open source code, it's [open creativity](https://adactio.com/articles/1522/). It's is [share and share alike](https://creativecommons.org/share-your-work/cclicenses/) to build, remix and replicate the best things on the internet. \n\n### Replicate \n\nWe should understand that there is no \"Long Now\". VCs, big clocks and big money are a fleeting phenomenon that is more likely to self-destruct or destroy us than it is to save us. The foundation of projects like The Long Now is built on the resources of people who think we need to maintain the present, scrolled out into an eternally status quo-maintaining future. \n\nLet me be blunt: The present isn't worth preserving. \n\nLet's think instead about **The Long Next**, a future where we build sustainably; live with the knowledge that [we can't be always-online](/resources/bookmarks/low-tech-magazine/); and consider a world that **we** sustain in our projects, groups and communities. The Long Next isn't about preserving wealth and capital long enough to catapult the rich to Mars, it is about holistic rewilding of the web, the Earth, the future. A world we can live in, not one we are going to sacrifice on the alter of wealthy egos. \n\nCentral archives are incredibly important, but they're also central points of failure, vulnerable not just to physical attacks, but to legal ones as well. Worse, it is at the mercy of big donors who have proved time and again that they'd rather burn the present to build their personal vision of the future than sustain it. It's hard to believe such people will forever consider supporting projects like The Internet Archive in their best interest, especially as they sit above companies whose works are focused on essentially in-housing that work *as a competitive advantage*. \n\nWe should continue to support big important archival projects. I think their work is amazing and deserves all our support to keep them going as long as we can. \n\nA long next, a sustainable future, means that we need to do more than that, we need to think about how to keep the archives of what is important to us close to home, replicate them across our local networks and retain their information in case of the worst. \n\nThe parts of the web that are most important to you should be available to you, even if the internet isn't.\n\nSo use your newly wild websites to preserve the parts of the web that matter to you. Host site-local archives with indicators that point back to and [300s](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_redirection) back to the originals. Keep the option to take them with you, or to drop redirects if they die so you'll have them *just in case*. Make sure to set up those local archives so they can be accessed by you, by others, and using your own search tools. [Submit](https://web.archive.org/save) [those](https://chromewebstore.google.com/detail/wayback-machine/fpnmgdkabkmnadcjpehmlllkndpkmiak) [links](https://archive.org/details/introduction-to-the-warc) [to](https://help.archive.org/help/uploading-a-basic-guide/) [The Internet Archive](https://help.archive.org/help/save-pages-in-the-wayback-machine/) at the same time. \n\n[Make sure what you build is easy for others to archive](https://jeffhuang.com/designed_to_last/).\n\n## The Future Soon \n\nThis is a summary. I think I could explore any one of these points more deeply and maybe I will. This is a good start at trying to describe what I want to do with this site and the other sites I'm working on.\n\nI think that working in public and thinking in public keeps me honest, so that's what I've got here. If it's interesting to you, maybe it is something you can explore as well, try to follow through with on your own websites. Increasingly I wish for a **zine-web** filled with tiny one-off websites and fun projects, a million well-tended webs intersecting with each other, and archived by their peers. \n\n\nWe can join our own little webs together. One thing is certain, making the web a better place isn't a project to undertake alone or in private. \n\n[Reach out on Mastodon to talk](https://indieweb.social/@Chronotope). \n\n~~\n\nSelected Responses: \n\n- [Don Marti](https://federate.social/@dmarti/112587045311696156)\n- I really like [the idea of bringing back Diskmags](https://elk.zone/indieweb.social/@teajaygrey@rap.social/112606872290801809). I was not familiar with the concept at all, but ended up [finding out about it when I researched the response](https://diskmags.de/index.php?title=Introduction) and I like the idea of removable media used as a potential model for a sometimes-on web. \n- There is [a really cool list of articles that talk about this topic of the future of a better web which you can check out](https://projects.kwon.nyc/internet-is-fun/). \n\n~~\n\nCover Image by <a href=\"https://commons.wikimedia.org/wiki/User:Chen-Pan_Liao\" title=\"User:Chen-Pan Liao\">Chen-Pan Liao</a> - <span class=\"int-own-work\" lang=\"en\">Own work</span>, <a href=\"https://creativecommons.org/licenses/by-sa/3.0\" title=\"Creative Commons Attribution-Share Alike 3.0\">CC BY-SA 3.0</a>, <a href=\"https://commons.wikimedia.org/w/index.php?curid=15926393\">Link</a>",
2020 "content": {
2121 "$type": "site.standard.content.markdown",
2222 "text": "> When I envision the web, I picture an infinite expanse of empty space that stretches as far as the eye can see. It's full of fertile soil, but no seeds have taken root. That is, except for about an acre of it.\n - Molly White, [We can have a different web](/noteworthy/we-can-have-a-different-web/)\n\nThe future of the internet seems up in the air. Consumed by rotting behemoths. What we have now is failing, but it is also part of our every-day life, our politics, our society, our communities and our friendships. All of those are at risk, in part because the ways we communicate are under attack. The fate of the open web is inextricable from the other ways our world is in crisis. \n\nWe face down a seemingly endless series of political, social, economic, and medical disasters on a melting planet. There is no doubt that the internet is deeply integrated into everything that is going both right and wrong.\n\nAt this moment, [we are actively discussing how to build a future for our shared global telecommunications network](https://aramzs.xyz/lists/a-future-for-the-web/). This is good. We need this discussion. We also need to acknowledge that the wide open platform for infinite data, innovation and communication isn't a shelter from the disaster, but it *is* at the heart of everything we do. The day we could go back from that, even if we wanted to, is long gone. That means [rewilding the web](https://www.noemamag.com/we-need-to-rewild-the-internet/) isn't **just** a matter of a better internet. Our way to a better web can't be purely technical. It's the matter of being part of the making of a better world. \n\nWith the problem so large, how do we approach a solution? If we want to plant a forest how do we grow the ground cover? \n\nDe-abstract. What is the internet really? It's wires, and waves (and occasionally, joking aside, [pipes](https://www.windsystemsmag.com/the-latest-advancements-in-submarine-cables-protection/)) all put to the purpose of connecting people to each other. \n\nThe internet then is the series of connections between [people](https://adactio.com/journal/18337), at a huge scale. Not everyone is connected to everyone, but if you're on the internet, you're connecting to *someone*. So it isn't so much a world wide web as it is world wide **webs**. \n\nThe future core of a [humane](https://humanewebmanifesto.com/) internet, if we are going to be able to use it to do the essential work of surviving this century, is a series of linked routes that stick us all together and supports our communities.\n\nI don't think there is only one solution, I couldn't possibly know them all, but I have one approach that has led me to launch this particular website (and [some others](/projects/)). \n\nThe thing about webs is [they are failure resistent, one strand falling won't take the whole thing down](https://news.mit.edu/2012/spider-web-strength-0202). You can punch a hole through them, but webs are also rebuilt regularly, they can fail and come back quickly. \n\nWe need to think of our connections and how we transmit information to each other in the same way. An important message should be able to travel edge to edge without interference and make it from web to web successfully. We need to think about *links*. Not just in the literal sense. We weave our communities together by establishing bedrocks of shared knowledge. \n\nI think what really put this into sharp focus for me is [the long death of Twitter](https://www.schizochronotopia.com/p/on-twitter-we-look-down). Twitter is still a platform where, for professional reasons, I'm quite active, but its biggest utility--directing me to information that I'm interested in or that is important to me--that's gone. \n\nWe need to rethink how amplification works without requiring big tech or even a steady internet connection. Here are three big assumptions sitting inside this larger question of how best to build our webs. \n\n1. Amplification through cross-linking between individual entities and feeds is essentially rejuvenating for the web. \n2. We [can't](https://ahrefs.com/blog/link-rot-study/) [take the life of those links for granted](https://www.pewresearch.org/data-labs/2024/05/17/when-online-content-disappears/) and an essential part of this rejuvenation process is archiving links that are important enough to amplify.\n3. In the current world [it is nearly impossible](https://www.nytimes.com/2020/07/31/technology/blocking-the-tech-giants.html) to build without touching or using the technology of a mega-corporation in some way so we should expect to build on things that will fail, enshittify, or rot, and need to be moved off from quickly.\n\n## To that end I've considered some principles for my own projects.\n\nThese (and the project of crafting them) are heavily inspired by [the IndieWeb principles](https://indieweb.org/principles). \n\n### Principles of Amplification for better webs\n\n- Aggregation is amplification.\n- In a post-Twitter world, reach requires coordination. \n- If it has to query a backend to load it will one day die. \n- Amplification is power, use it responsibly. \n- Massive replication of your own work is good. Massive aggregation between members of a community is even better. \n- [Amplification](/thoughts/using-amplify-as-a-type/) is a method to build community\n- You can always [check out](https://dataprivacymanager.net/what-is-data-subject-access-request-dsar/), copy, or scrape your work from other platforms and take ownership.\n\n### Principles of Archiving for better webs\n\n- Using the web downloads it to your computer, you should get to keep it for your personal use.\n- [Kill the app](https://tweets.aramzs.com/1390071898202120192/). They are black boxes filled with content and knowledge that will one day be lost forever.\n- Everyone should support the Internet Archive, but we [shouldn't](https://www.forbes.com/sites/mattnovak/2023/05/28/internet-archive-suffers-major-global-outage/) assume it is invulnerable. \n- Own your own archive. \n- Single points of failure are dangerous and, as an expected operating tool, destroy innovation.\n- Anything that can't fit on its own offline drive will die.\n\n### Principles of Web Weaving\n\n- Connecting to each other connects our audiences.\n- Curated connections form bridges out of the walled gardens that hurt us and our society. \n- Accept the rotting giant corporations that harvest human connections for profit, realize you must exist in their context to help others, and use their platforms and technology as a vaulting poll to bring yourself and others outside the walls.\n- The [baseline has shifted](/glossary/shifting-baselines/) away from an open web, but if we act like we are already in the future we want to build we can shift them again.\n\n## The Long Next\n\nWith these concepts in mind, I think of a lot of acronyms I've been considering as part of the future of the web: \n\n- [ESC](https://esc.fyi/) - End Surveillance Capitalism\n- [POSSE](https://indieweb.org/POSSE) - Publish (on your) Own Site, Syndicate Elsewhere\n- [PESOS](https://indieweb.org/PESOS) - Publish Elsewhere, Syndicate (to your) Own Site\n\nI want to add one more to the list. \n\nWe need to think about how to [ENTER](/glossary/enter/) the wild web.\n\n### Extract\n\nFor now it's [impossible to interact with others and move through this world without touching big tech](https://www.nytimes.com/2020/07/31/technology/blocking-the-tech-giants.html). With this in mind, we are all going to end up using some of those platforms. So what we need are methods to extract the data off those platforms. There are blunt ways like scraping, and potentially captured ways like platform APIs. However, thanks to the explosion of privacy and interoperability-related legislation around the world, [most sites have an option to check out all your data](https://dataprivacymanager.net/what-is-data-subject-access-request-dsar/). \n\nOnce you have reclaimed your own works, you can do all sorts of things with it. Eventually you can even leave the platform, delete everything, and take canonical status for that work with your own sites. [I'm just getting started](https://aramzs.xyz/tutorials/how-to-export-your-links-from-pocket/), but I plan on writing more about how to do this.\n\n### Nullify \n\nRedirect or cross link your own sites and platform over the big tech ones whenever possible. Once you've linked off a enshittified platform and brought someone out of the walled garden and into your web, it's important to give them ways to interact with the internet that don't just push them right back into the hands of big tech. Whenever possible, push readers to open and wild web alternatives. \n\nCreate sites and networks that aren't just informative, but also fun to explore. \n\n### Transform \n\nTake the posts you've checked out or otherwise extracted and turn them into something new and cool. Everything we post on social media platforms owned by big tech companies is limited by the business models and requirement to render ad targeting data. It shapes our participation in ways we aren't aware of. Once we free our *own* works from those platforms, take the time and effort to turn them into something cool and new, no longer limited by the constraints from inside the wall. \n\nOne of my main projects for this site is building tools for transforming data extractions from [Letterboxd](/lists/film-and-tv/), [Pocket](/amplify/), and [Kindle](/resources/quotes/).\n\n### Exchange \n\nBuild community though connecting. Link to other people, this is hardly a new idea, but it does seem to have fallen by the wayside at various periods of the social web. \n\nTruly fair exchanges between members of the (or a) web means more than that though, it means actively getting permission from others to remix their work and doing it. It means using and building on top of the work of others in all formats, not just code.\n\nIt also means: [copyleft](https://en.wikipedia.org/wiki/Copyleft) your work. The future of the web is not copyrighted. The future of the web is post-capitalism. Trying to play copyright games with big tech is a losing game, all we get is siloed culture that big tech steals anyway, either directly or in forms of aggregation or by bundling it into AI which spits it back out as plagiarism and bullshit. The future of the web isn't just open source code, it's [open creativity](https://adactio.com/articles/1522/). It's is [share and share alike](https://creativecommons.org/share-your-work/cclicenses/) to build, remix and replicate the best things on the internet. \n\n### Replicate \n\nWe should understand that there is no \"Long Now\". VCs, big clocks and big money are a fleeting phenomenon that is more likely to self-destruct or destroy us than it is to save us. The foundation of projects like The Long Now is built on the resources of people who think we need to maintain the present, scrolled out into an eternally status quo-maintaining future. \n\nLet me be blunt: The present isn't worth preserving. \n\nLet's think instead about **The Long Next**, a future where we build sustainably; live with the knowledge that [we can't be always-online](/resources/bookmarks/low-tech-magazine/); and consider a world that **we** sustain in our projects, groups and communities. The Long Next isn't about preserving wealth and capital long enough to catapult the rich to Mars, it is about holistic rewilding of the web, the Earth, the future. A world we can live in, not one we are going to sacrifice on the alter of wealthy egos. \n\nCentral archives are incredibly important, but they're also central points of failure, vulnerable not just to physical attacks, but to legal ones as well. Worse, it is at the mercy of big donors who have proved time and again that they'd rather burn the present to build their personal vision of the future than sustain it. It's hard to believe such people will forever consider supporting projects like The Internet Archive in their best interest, especially as they sit above companies whose works are focused on essentially in-housing that work *as a competitive advantage*. \n\nWe should continue to support big important archival projects. I think their work is amazing and deserves all our support to keep them going as long as we can. \n\nA long next, a sustainable future, means that we need to do more than that, we need to think about how to keep the archives of what is important to us close to home, replicate them across our local networks and retain their information in case of the worst. \n\nThe parts of the web that are most important to you should be available to you, even if the internet isn't.\n\nSo use your newly wild websites to preserve the parts of the web that matter to you. Host site-local archives with indicators that point back to and [300s](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_redirection) back to the originals. Keep the option to take them with you, or to drop redirects if they die so you'll have them *just in case*. Make sure to set up those local archives so they can be accessed by you, by others, and using your own search tools. [Submit](https://web.archive.org/save) [those](https://chromewebstore.google.com/detail/wayback-machine/fpnmgdkabkmnadcjpehmlllkndpkmiak) [links](https://archive.org/details/introduction-to-the-warc) [to](https://help.archive.org/help/uploading-a-basic-guide/) [The Internet Archive](https://help.archive.org/help/save-pages-in-the-wayback-machine/) at the same time. \n\n[Make sure what you build is easy for others to archive](https://jeffhuang.com/designed_to_last/).\n\n## The Future Soon \n\nThis is a summary. I think I could explore any one of these points more deeply and maybe I will. This is a good start at trying to describe what I want to do with this site and the other sites I'm working on.\n\nI think that working in public and thinking in public keeps me honest, so that's what I've got here. If it's interesting to you, maybe it is something you can explore as well, try to follow through with on your own websites. Increasingly I wish for a **zine-web** filled with tiny one-off websites and fun projects, a million well-tended webs intersecting with each other, and archived by their peers. \n\n\nWe can join our own little webs together. One thing is certain, making the web a better place isn't a project to undertake alone or in private. \n\n[Reach out on Mastodon to talk](https://indieweb.social/@Chronotope). \n\n~~\n\nSelected Responses: \n\n- [Don Marti](https://federate.social/@dmarti/112587045311696156)\n- I really like [the idea of bringing back Diskmags](https://elk.zone/indieweb.social/@teajaygrey@rap.social/112606872290801809). I was not familiar with the concept at all, but ended up [finding out about it when I researched the response](https://diskmags.de/index.php?title=Introduction) and I like the idea of removable media used as a potential model for a sometimes-on web. \n- There is [a really cool list of articles that talk about this topic of the future of a better web which you can check out](https://projects.kwon.nyc/internet-is-fun/). \n\n~~\n\nCover Image by <a href=\"https://commons.wikimedia.org/wiki/User:Chen-Pan_Liao\" title=\"User:Chen-Pan Liao\">Chen-Pan Liao</a> - <span class=\"int-own-work\" lang=\"en\">Own work</span>, <a href=\"https://creativecommons.org/licenses/by-sa/3.0\" title=\"Creative Commons Attribution-Share Alike 3.0\">CC BY-SA 3.0</a>, <a href=\"https://commons.wikimedia.org/w/index.php?curid=15926393\">Link</a>",
···4848 AVIF = "image/avif"
4949}
50505151+type BskyPostRef = {
5252+ "$type": "com.atproto.repo.strongRef",
5353+ "uri": `at://did:plc:${string}`,
5454+ "cid": string
5555+ }
5656+5157type SiteStandardDocInitObj = {
5258 site: `at://${string}` | `https://${string}`,
5359 path: `/${string}`,
···6268 coverImage?: {
6369 $type: "blob",
6470 ref: {
6565- $link: string
7171+ $link: string
6672 },
6773 mimeType: ImageMimeType
6874 },
6975 bskyPostRef?: {
7070- "$type": "com.atproto.repo.strongRef",
7171- "uri": `at://did:plc:${string}`,
7272- "cid": string
7373- },
7676+ "$type"?: "com.atproto.repo.strongRef",
7777+ "uri": `at://did:plc:${string}`,
7878+ "cid": string
7979+ },
7480 content?: {
7581 "$type": string,
7682 "text"?: string,
···80868187// Define a class that can hold the properties and logic of a site.standard.document
82888383-class SiteStandardDocument {
8989+export class SiteStandardDocument {
8490 public $type: string = "site.standard.document"
8591 public site: `at://${string}` | `https://${string}`
8692 public path: `/${string}`
···105111 },
106112 mimeType: ImageMimeType
107113 }
108108- public bskyPostRef?: {
109109- "$type": "com.atproto.repo.strongRef",
110110- "uri": `at://did:plc:${string}`,
111111- "cid": string
112112- }
114114+ public bskyPostRef?: BskyPostRef
113115 constructor(init: SiteStandardDocInitObj) {
114116 this.$type = "site.standard.document"
115117 this.site = init.site;
···121123 this.tags = init.tags;
122124 this.rkey = init.rkey;
123125 this.coverImage = init.coverImage;
124124- this.bskyPostRef = init.bskyPostRef;
125126 this.markdownContent = init.markdownContent;
126127 this.textContent = this.markdownToTextContent(init.markdownContent);
127128 if (init.content){
128129 this.content = init.content;
129130 } else {
130131 this.content = this.markdownToContent(init.markdownContent);
132132+ }
133133+ if (init.bskyPostRef) {
134134+ this.setBskyRef(init.bskyPostRef.uri, init.bskyPostRef.cid);
131135 }
132136 // this.textContent = init.markdownContent;
133137 // this.content = init.markdownContent;
···143147 }
144148145149 markdownToTextContent(value: string){
146146- return "";
150150+ // strip value of any HTML markup or markdown
151151+ // replace line breaks with `\n`
152152+153153+ let newValue = value;
154154+155155+ // Remove HTML tags
156156+ newValue = newValue.replace(/<[^>]*>/g, '');
157157+158158+ // Remove markdown images:  -> alt (do this before links)
159159+ newValue = newValue.replace(/!\[([^\]]*)\]\([^\)]+\)/g, '$1');
160160+161161+ // Remove markdown links but keep the text: [text](url) -> text
162162+ newValue = newValue.replace(/\[([^\]]+)\]\([^\)]+\)/g, '$1');
163163+164164+ // Remove markdown headers: ## Header -> Header
165165+ newValue = newValue.replace(/^#{1,6}\s+/gm, '');
166166+167167+ // Remove bold/italic: **text** or *text* or __text__ or _text_ -> text
168168+ newValue = newValue.replace(/\*\*([^*]+)\*\*/g, '$1');
169169+ newValue = newValue.replace(/__([^_]+)__/g, '$1');
170170+ newValue = newValue.replace(/\*([^*]+)\*/g, '$1');
171171+ newValue = newValue.replace(/_([^_]+)_/g, '$1');
172172+173173+ // Remove code blocks: ```code``` -> (remove entirely)
174174+ // newValue = newValue.replace(/```[\s\S]*?```/g, '');
175175+176176+ // Remove inline code: `code` -> code
177177+ // newValue = newValue.replace(/`([^`]+)`/g, '$1');
178178+179179+ // Remove blockquotes but keep content: > quote -> quote (with leading space)
180180+ newValue = newValue.replace(/^>\s*/gm, '');
181181+182182+ // Remove horizontal rules: --- or *** or ___
183183+ newValue = newValue.replace(/^[-*_]{3,}\s*$/gm, '');
184184+185185+ // Remove list markers: - item or * item or + item or 1. item -> item
186186+ newValue = newValue.replace(/^[\s]*[-*+]\s+/gm, '');
187187+ newValue = newValue.replace(/^[\s]*\d+\.\s+/gm, '');
188188+189189+ // Normalize line breaks to \n
190190+ newValue = newValue.replace(/\r\n/g, '\n');
191191+ newValue = newValue.replace(/\r/g, '\n');
192192+193193+ // Remove excessive whitespace but preserve double line breaks
194194+ newValue = newValue.replace(/\n{3,}/g, '\n\n');
195195+196196+ // Clean up any remaining extra spaces at line starts/ends
197197+ newValue = newValue.split('\n').map(line => line.trim()).join('\n');
198198+199199+ // Final trim
200200+ newValue = newValue.trim();
201201+202202+ return newValue;
147203 }
148204205205+ setBskyRef(uri: `at://did:plc:${string}`, cid: string){
206206+ this.bskyPostRef = {
207207+ "$type": "com.atproto.repo.strongRef",
208208+ "uri": uri,
209209+ "cid": cid
210210+ };
211211+ }
149212150213 // Method to update the content of the document
151214 updateContent(newContent: string) {
152152- this.content = {
153153- "$type": "site.standard.content.markdown",
154154- "text": newContent,
155155- "version": "1.0"
156156- };
157157- this.textContent = newContent;
215215+ this.markdownContent = newContent
216216+ this.content = this.markdownToContent(newContent);
217217+ this.textContent = this.markdownToTextContent(newContent);
158218 this.updatedAt = new Date();
159219 }
160220···170230 this.tags = this.tags.filter(t => t !== tag);
171231 }
172232233233+ exportForMarkdown() {
234234+ const markdownReadyObj: {
235235+ site: string,
236236+ coverBlob?: string | false,
237237+ bskyPostRef?: {
238238+ "uri": `at://did:plc:${string}`,
239239+ "cid": string
240240+ },
241241+ rkey?: string
242242+ } = {
243243+ site: this.site
244244+ }
245245+ if (this.coverImage) {
246246+ markdownReadyObj.coverBlob = this.coverImage ? this.coverImage.ref.$link : false
247247+ }
248248+ if (this.bskyPostRef) {
249249+ markdownReadyObj.bskyPostRef = this.bskyPostRef;
250250+ }
251251+ if (this.rkey) {
252252+ markdownReadyObj.rkey = this.rkey;
253253+ }
254254+ return markdownReadyObj;
255255+ }
256256+173257 exportToAtProto() {
174258175259 // return an object that meets the site.standard.document object specifications for writing to a PDS.
···189273 tags: string[],
190274 publishedAt: string,
191275 updatedAt?: string,
192192- rkey?: string,
193276 coverImage?: {
194277 $type: "blob",
195278 ref: {
···197280 },
198281 mimeType: ImageMimeType
199282 },
200200- bskyPostRef?: {
201201- "$type": "com.atproto.repo.strongRef",
202202- "uri": `at://did:plc:${string}`,
203203- "cid": string
204204- }
283283+ bskyPostRef?: BskyPostRef
205284 } = {
206285 $type: "site.standard.document",
207286 site: this.site,
···223302 atProtoDoc.coverImage = this.coverImage;
224303 }
225304226226- if (this.bskyPostRef) {
305305+ if (this.bskyPostRef && this.bskyPostRef["$type"] && this.bskyPostRef["$type"] === "com.atproto.repo.strongRef") {
306306+ atProtoDoc.bskyPostRef = this.bskyPostRef;
307307+ } else if (this.bskyPostRef) {
308308+ this.setBskyRef(this.bskyPostRef.uri, this.bskyPostRef.cid)
227309 atProtoDoc.bskyPostRef = this.bskyPostRef;
228310 }
229311