{"id":17310591,"url":"https://github.com/digitalmoksha/mdurl-rb","last_synced_at":"2025-03-27T00:26:12.382Z","repository":{"id":29354585,"uuid":"32888858","full_name":"digitalmoksha/mdurl-rb","owner":"digitalmoksha","description":"URL utilities for motion-markdown-it","archived":false,"fork":false,"pushed_at":"2023-01-14T18:30:23.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T03:38:48.121Z","etag":null,"topics":["ruby","rubymotion"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digitalmoksha.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-25T20:25:34.000Z","updated_at":"2023-01-14T18:27:00.000Z","dependencies_parsed_at":"2023-01-16T22:30:37.172Z","dependency_job_id":null,"html_url":"https://github.com/digitalmoksha/mdurl-rb","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalmoksha%2Fmdurl-rb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalmoksha%2Fmdurl-rb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalmoksha%2Fmdurl-rb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalmoksha%2Fmdurl-rb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digitalmoksha","download_url":"https://codeload.github.com/digitalmoksha/mdurl-rb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245757724,"owners_count":20667395,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ruby","rubymotion"],"created_at":"2024-10-15T12:37:46.768Z","updated_at":"2025-03-27T00:26:12.361Z","avatar_url":"https://github.com/digitalmoksha.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mdurl-rb\n\n[![Gem Version](https://badge.fury.io/rb/mdurl-rb.svg)](http://badge.fury.io/rb/mdurl-rb)\n[![Build Status](https://github.com/digitalmoksha/mdurl-rb/actions/workflows/ci.yml/badge.svg)](https://github.com/digitalmoksha/mdurl-rb/actions/workflows/ci.yml)\n\nThis gem is a port of the [mdurl javascript package](https://github.com/markdown-it/mdurl) by Vitaly Puzrin and Alex Kocharin, that is used for the [markdown-it](https://github.com/markdown-it/markdown-it) package.\n\n_Currently synced with mdurl 1.0.1_\n\n---\n\nURL utilities for [motion-markdown-it](https://github.com/digitalmoksha/motion-markdown-it) parser, for both Ruby and RubyMotion\n\n## API\n\n_As this gem was ported from the Javascript version, there may still be some mixture of Javascript terminology below'_\n\n### MDUrl::Encode.encode(str [, exclude, keepEncoded]) -\u003e String\n\nPercent-encode a string, avoiding double encoding. Don't touch `/a-zA-Z0-9/` +\nexcluded chars + `/%[a-fA-F0-9]{2}/` (if not disabled). Broken surrorates are\nreplaced with `U+FFFD`.\n\nParams:\n\n- __str__ - input string.\n- __exclude__ - optional, `;/?:@\u0026=+$,-_.!~*'()#`. Additional chars to keep intact\n  (except `/a-zA-Z0-9/`).\n- __keepEncoded__ - optional, `true`. By default it skips already encoded sequences\n  (`/%[a-fA-F0-9]{2}/`). If set to `false`, `%` will be encoded.\n\n\n### MDUrl::Encode::DEFAULT_CHARACTERS, MDUrl::Encode::COMPONENT_CHARACTERS\n\nYou can use these constants as second argument to `encode` function.\n\n - `DEFAULT_CHARACTERS` is the same exclude set as in the standard `encodeURI()` function\n - `COMPONENT_CHARACTERS` is the same exclude set as in the `encodeURIComponent()` function\n\nFor example, `MDUrl::Encode.encode('something', MDUrl::Encode::COMPONENT_CHARACTERS, true)` is roughly the equivalent of\nthe `encodeURIComponent()` function in Javascript (except `encode()` doesn't throw).\n\n\n### MDUrl::Decode.decode(str [, exclude]) -\u003e String\n\nDecode percent-encoded string. Invalid percent-encoded sequences (e.g. `%2G`)\nare left as is. Invalid UTF-8 characters are replaced with `U+FFFD`.\n\n\nParams:\n\n- __str__ - input string.\n- __exclude__ - set of characters to leave encoded, optional, `;/?:@\u0026=+$,#`.\n\n\n### MDUrl::Decode::DEFTAULT_CHARS, MDUrl::Decode::COMPONENT_CHARS\n\nYou can use these constants as second argument to `decode` function.\n\n - `DEFTAULT_CHARS` is the same exclude set as in the standard `decodeURI()` function\n - `COMPONENT_CHARS` is the same exclude set as in the `decodeURIComponent()` function\n\nFor example, `MDUrl::Decode.decode('something', MDUrl::Decode::DEFTAULT_CHARS)` has the same behavior as\n`decodeURI('something')` in javascript on a correctly encoded input.\n\n\n### MDUrl::Url.parse(url, slashesDenoteHost) -\u003e urlObs\n\nParse url string. Similar to node's [url.parse](http://nodejs.org/api/url.html#url_url_parse_urlstr_parsequerystring_slashesdenotehost), but without any\nnormalizations and query string parse.\n\n - __url__ - input url (string)\n - __slashesDenoteHost__ - if url starts with `//`, expect a hostname after it. Optional, `false`.\n\nResult (hash):\n\n- protocol\n- slashes\n- auth\n- port\n- hostname\n- hash\n- search\n- pathname\n\nDifference with node's `url`:\n\n1. No leading slash in paths, e.g. in `url.parse('http://foo?bar')` pathname is\n   `\"\"` (empty string), not `\"/\"`\n2. Backslashes are not replaced with slashes, so `http:\\\\example.org\\` is\n   treated like a relative path\n3. Trailing colon is treated like a part of the path, i.e. in\n   `http://example.org:foo` pathname is `:foo`\n4. Nothing is URL-encoded in the resulting object, (in joyent/node some chars\n   in auth and paths are encoded)\n5. `url.parse()` does not have `parseQueryString` argument\n6. Removed extraneous result properties: `host`, `path`, `query`, etc.,\n   which can be constructed using other parts of the url.\n\n\n### MDUrl::Format.format(urlObject)\n\nFormat an object previously obtained with `.parse()` function. Similar to node's\n[url.format](http://nodejs.org/api/url.html#url_url_format_urlobj).\n\n\n## License\n\n[MIT](https://github.com/markdown-it/mdurl/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalmoksha%2Fmdurl-rb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalmoksha%2Fmdurl-rb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalmoksha%2Fmdurl-rb/lists"}