Skip to content

Commit

Permalink
Merge branch 'main' into chore/improve-relative-link-validation
Browse files Browse the repository at this point in the history
  • Loading branch information
techfg committed Apr 19, 2024
2 parents 13ca9be + c93bd7c commit 86a579f
Show file tree
Hide file tree
Showing 21 changed files with 1,622 additions and 632 deletions.
29 changes: 24 additions & 5 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,33 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Enable corepack
run: |
corepack enable
# Setup .npmrc file to publish to npm
run: corepack enable
- uses: ruby/setup-ruby@v1
- name: "Install github_changelog_generator"
run: gem install github_changelog_generator
- name: Generate CHANGELOG.md"
env:
CHANGELOG_GITHUB_TOKEN: ${{ secrets.CHANGELOG_GITHUB_TOKEN }}
run: github_changelog_generator
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- run: yarn
- run: yarn npm publish
cache: "yarn"
- name: Install Dependencies
run: yarn --frozen-lockfile
- name: Publish
run: yarn npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: "Commit CHANGELOG.md"
run: |
git add CHANGELOG.md
if [ ! -n "$(git status -s)" ]; then
echo "NOTHING TO COMMIT"
else
git config user.name "Alex Vernacchia"
git config user.email "vernak2539@users.noreply.github.com"
git commit -m "[skip ci] Update CHANGELOG.md"
git push origin main --no-verify
fi
6 changes: 2 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ on:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Enable corepack
run: |
corepack enable
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Update Changelog
on:
workflow_dispatch:
branches:
- main

permissions:
contents: write

jobs:
update_changelog:
if: github.ref_name == github.event.repository.default_branch
runs-on: ubuntu-latest
environment:
name: npm-publish
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
- name: "Install github_changelog_generator"
env:
CHANGELOG_GITHUB_TOKEN: ${{ secrets.CHANGELOG_GITHUB_TOKEN }}
run: gem install github_changelog_generator
- name: "Generate and commit CHANGELOG.md"
run: |
github_changelog_generator
git add CHANGELOG.md
if [ ! -n "$(git status -s)" ]; then
echo "NOTHING TO COMMIT"
else
git config user.name "Alex Vernacchia"
git config user.email "vernak2539@users.noreply.github.com"
git commit -m "[skip ci] Update CHANGELOG.md"
git push --no-verify
fi
3 changes: 3 additions & 0 deletions .github_changelog_generator
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
project=astro-rehype-relative-markdown-links
user=vernak2539
unreleased=false
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.2
893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.1.1.cjs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
nodeLinker: node-modules

npmAuthToken: "${NODE_AUTH_TOKEN:-}"

yarnPath: .yarn/releases/yarn-4.1.1.cjs
289 changes: 105 additions & 184 deletions CHANGELOG.md

Large diffs are not rendered by default.

30 changes: 18 additions & 12 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,33 @@ astro-rehype-relative-markdown-links

- [Options](interfaces/Options.md)

### Type Aliases
### Functions

- [CollectionPathMode](README.md#collectionpathmode)
- [TrailingSlash](README.md#trailingslash)
- [default](README.md#default)

## Type Aliases
## Functions

### CollectionPathMode
### default

Ƭ **CollectionPathMode**: ``"subdirectory"`` \| ``"root"``
**default**(`this`, `...parameters`): `undefined` \| `void` \| `Transformer`\<`Root`, `Root`\>

#### Defined in
Rehype plugin for Astro to add support for transforming relative links in MD and MDX files into their final page paths.

#### Parameters

| Name | Type |
| :------ | :------ |
| `this` | `Processor`\<`undefined`, `undefined`, `undefined`, `undefined`, `undefined`\> |
| `...parameters` | [(null \| Options)?] |

[index.d.ts:1](https://github.com/vernak2539/astro-rehype-relative-markdown-links/blob/main/src/index.d.ts#L1)
#### Returns

___
`undefined` \| `void` \| `Transformer`\<`Root`, `Root`\>

### TrailingSlash
**`See`**

Ƭ **TrailingSlash**: ``"always"`` \| ``"never"`` \| ``"ignore"``
[Options](interfaces/Options.md)

#### Defined in

[index.d.ts:3](https://github.com/vernak2539/astro-rehype-relative-markdown-links/blob/main/src/index.d.ts#L3)
[src/index.mjs:33](https://github.com/vernak2539/astro-rehype-relative-markdown-links/blob/main/src/index.mjs#L33)
38 changes: 30 additions & 8 deletions docs/interfaces/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

# Interface: Options

## Hierarchy

- `input`\<`OptionsSchemaType`\>

**`Options`**

## Table of contents

### Properties
Expand Down Expand Up @@ -37,15 +43,19 @@ In the example below, `astro dev` will start your server at `/docs`.
}
```

#### Inherited from

z.input.basePath

#### Defined in

[index.d.ts:52](https://github.com/vernak2539/astro-rehype-relative-markdown-links/blob/main/src/index.d.ts#L52)
[src/options.mjs:50](https://github.com/vernak2539/astro-rehype-relative-markdown-links/blob/main/src/options.mjs#L50)

___

### collectionPathMode

`Optional` **collectionPathMode**: [`CollectionPathMode`](../README.md#collectionpathmode)
`Optional` **collectionPathMode**: ``"root"`` \| ``"subdirectory"``

**`Name`**

Expand Down Expand Up @@ -74,9 +84,13 @@ set this value and the default of `subdirectory` will be used.
}
```

#### Inherited from

z.input.collectionPathMode

#### Defined in

[index.d.ts:36](https://github.com/vernak2539/astro-rehype-relative-markdown-links/blob/main/src/index.d.ts#L36)
[src/options.mjs:33](https://github.com/vernak2539/astro-rehype-relative-markdown-links/blob/main/src/options.mjs#L33)

___

Expand All @@ -96,15 +110,19 @@ contentPath

This defines where the content (i.e. md, mdx, etc. files) is stored. This should be a path relative to the root directory

#### Inherited from

z.input.contentPath

#### Defined in

[index.d.ts:14](https://github.com/vernak2539/astro-rehype-relative-markdown-links/blob/main/src/index.d.ts#L14)
[src/options.mjs:12](https://github.com/vernak2539/astro-rehype-relative-markdown-links/blob/main/src/options.mjs#L12)

___

### trailingSlash

`Optional` **trailingSlash**: [`TrailingSlash`](../README.md#trailingslash)
`Optional` **trailingSlash**: ``"always"`` \| ``"never"`` \| ``"ignore"``

**`Name`**

Expand All @@ -123,8 +141,8 @@ Allows you to control the behavior for how trailing slashes should be handled on

When set to `'ignore'` (the default), the following will occur:
- If there is not a custom slug on the target file, the markdown link itself will determine if there is a trailing slash.
- `[Example](./my-doc.md/))` will result in a trailing slash
- `[Example](./my-doc.md))` will not result in a trailing slash
- `[Example](./my-doc.md/)` will result in a trailing slash
- `[Example](./my-doc.md)` will not result in a trailing slash
- If there is a custom slug on the target file, the custom slug determines if there is a trailing slash.
- `slug: my-doc/` will result in a trailing slash
- `slug: my-doc` will not result in a trailing slash
Expand All @@ -142,6 +160,10 @@ When set to `'ignore'` (the default), the following will occur:

[https://docs.astro.build/en/reference/configuration-reference/#trailingslash|Astro](https://docs.astro.build/en/reference/configuration-reference/#trailingslash|Astro)

#### Inherited from

z.input.trailingSlash

#### Defined in

[index.d.ts:80](https://github.com/vernak2539/astro-rehype-relative-markdown-links/blob/main/src/index.d.ts#L80)
[src/options.mjs:77](https://github.com/vernak2539/astro-rehype-relative-markdown-links/blob/main/src/options.mjs#L77)
25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "astro-rehype-relative-markdown-links",
"description": "A rehype plugin built for Astro that aims to transform relative links in MD and MDX files into the proper URL path",
"version": "0.12.0",
"version": "0.12.2",
"keywords": [
"astro",
"rehype",
Expand All @@ -15,8 +15,10 @@
"files": [
"src/index.mjs",
"src/utils.mjs",
"src/options.mjs",
"src/**/*.d.ts",
"README.md"
"README.md",
"docs/**/*.md"
],
"repository": {
"type": "git",
Expand All @@ -31,33 +33,32 @@
"packageManager": "yarn@4.1.1",
"scripts": {
"pre-release": "yarn run changelog && yarn run prettier && yarn run generate-docs",
"generate-docs": "typedoc --readme none --gitRevision main --plugin typedoc-plugin-markdown src/index.d.ts",
"changelog": "auto-changelog -p",
"generate-docs": "typedoc --readme none --gitRevision main --plugin typedoc-plugin-markdown src",
"prettier": "prettier ./src/** -w",
"test": "node --test"
"test": "node --loader=esmock --test",
"type-check": "tsc --noEmit --emitDeclarationOnly false"
},
"dependencies": {
"catch-unknown": "^2.0.0",
"debug": "^4.3.4",
"github-slugger": "^2.0.0",
"gray-matter": "^4.0.3",
"is-absolute-url": "^4.0.1",
"unist-util-visit": "^4.1.2",
"unified": "^11.0.4",
"unist-util-visit": "^5.0.0",
"zod": "^3.22.4"
},
"peerDependencies": {
"astro": ">=2.x <5"
},
"devDependencies": {
"auto-changelog": "^2.4.0",
"@types/debug": "^4.1.12",
"@types/node": "^18.17.8",
"esmock": "^2.6.4",
"prettier": "^4.0.0-alpha.8",
"rehype": "^13.0.1",
"typedoc": "^0.25.13",
"typedoc-plugin-markdown": "^3.17.1",
"typescript": "^5.4.5"
},
"auto-changelog": {
"template": "keepachangelog",
"hideCredit": true,
"commitLimit": false
}
}

0 comments on commit 86a579f

Please sign in to comment.