Skip to content

Commit

Permalink
feat(v2): add relative uri support
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Sep 15, 2020
1 parent 9bf4dfb commit 41f09d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,14 @@ describe('validation schemas', () => {
test('URISchema', () => {
const validURL = 'https://docusaurus.io';
const doubleHash = 'https://docusaurus.io#github#/:';
const relativeUrl = '//docusaurus.io';
const invalidURL = 'invalidURL';
const urlFromIssue = 'https://riot.im/app/#/room/#ligo-public:matrix.org';

const {testFail, testOK} = createTestHelpers({schema: URISchema});
testOK(validURL);
testOK(doubleHash);
testOK(relativeUrl);
testFail(invalidURL);
testOK(urlFromIssue);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const RehypePluginsSchema = MarkdownPluginsSchema;
export const AdmonitionsSchema = Joi.object().default({});

export const URISchema = Joi.alternatives(
Joi.string().uri(),
Joi.string().uri({allowRelative: true}),
Joi.custom((val, helpers) => {
try {
const url = new URL(val);
Expand Down

0 comments on commit 41f09d9

Please sign in to comment.