Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ jobs:
uses: actions/checkout@master

- name: Setup Node.js
uses: actions/setup-node@v2.1.4
uses: actions/setup-node@v4
with:
node-version: '18.19'
node-version: '24'
registry-url: 'https://registry.npmjs.org'
always-auth: true

- name: Cache Dependencies
id: cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-node24-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
${{ runner.os }}-node24-

- name: Install Dependencies
run: npm ci
Expand Down
28 changes: 21 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Test

on:
pull_request:
push:
branches-ignore:
- develop
Expand All @@ -9,27 +10,31 @@ on:
- stage

jobs:
build:
test:
name: test (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['18.19', '24']
steps:
- name: Checkout Repo
uses: actions/checkout@master
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v2.1.4
uses: actions/setup-node@v4
with:
node-version: '18.19'
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
always-auth: true

- name: Cache Dependencies
id: cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
${{ runner.os }}-node${{ matrix.node-version }}-

- name: Install Dependencies
run: npm ci
Expand All @@ -39,3 +44,12 @@ jobs:

- name: Build
run: npm run build

build:
name: build
runs-on: ubuntu-latest
needs: test
if: ${{ always() }}
steps:
- name: Check test matrix result
run: test "${{ needs.test.result }}" = "success"
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
unsafe-perm=true
legacy-peer-deps=true
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@matters/matters-editor",
"version": "0.3.1",
"version": "0.3.3",
"description": "Editor for matters.news",
"author": "https://github.com/thematters",
"homepage": "https://github.com/thematters/matters-editor",
Expand All @@ -9,7 +9,7 @@
"url": "git@github.com:thematters/matters-editor.git"
},
"engines": {
"node": ">=18.19 <19.0"
"node": ">=18.19 <25.0.0"
},
"license": "MIT",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion src/editors/extensions/link/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export const Link = Mark.create<LinkOptions>({
defaultProtocol: 'http',
HTMLAttributes: {
target: '_blank',
rel: 'noopener noreferrer nofollow',
rel: 'noopener noreferrer ugc nofollow',
class: null,
},
validate: (url) => !!url,
Expand Down
4 changes: 2 additions & 2 deletions src/editors/extensions/mention.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Suggestion, { type SuggestionOptions } from '@tiptap/suggestion'
* data-id="ID"
* data-display-name="DISPLAYNAME"
* data-user-name="USERNAME"
* rel="noopener noreferrer nofollow"
* rel="noopener noreferrer ugc nofollow"
* >
* <span>@USERNAME</span>
* </a>
Expand Down Expand Up @@ -116,7 +116,7 @@ export const Mention = Node.create<MentionOptions>({
'data-id': node.attrs.id,
'data-user-name': node.attrs.userName,
'data-display-name': node.attrs.displayName,
rel: 'noopener noreferrer nofollow',
rel: 'noopener noreferrer ugc nofollow',
},
['span', `@${node.attrs.displayName ?? node.attrs.userName}`],
]
Expand Down
6 changes: 3 additions & 3 deletions src/transformers/html2md2html.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ describe('HTML to Markdown: Basic Formats', () => {
test('link', () => {
html2md2html(
`
<p>My favorite search engine is <a href="https://duckduckgo.com" target="_blank" rel="noopener nofollow noreferrer">Duck Duck Go</a>.</p>
<p>My favorite search engine is <a href="https://duckduckgo.com" target="_blank" rel="noopener noreferrer ugc nofollow">Duck Duck Go</a>.</p>
`,
'My favorite search engine is [Duck Duck Go](https://duckduckgo.com).',
)
Expand All @@ -291,7 +291,7 @@ describe('HTML to Markdown: Basic Formats', () => {
html2md2html(
`
<p>
<a href="https://www.flickr.com/photos/beaurogers/31833779864/in/abc.png" target="_blank" rel="noopener nofollow noreferrer">
<a href="https://www.flickr.com/photos/beaurogers/31833779864/in/abc.png" target="_blank" rel="noopener noreferrer ugc nofollow">
<img src="https://mdg.imgix.net/assets/images/shiprock.jpg" alt="An old rock in the desert" title="Shiprock, New Mexico by Beau Rogers" />
</a>
</p>
Expand Down Expand Up @@ -376,7 +376,7 @@ describe('HTML to Markdown: Full Content', () => {
<p>Dolore labore laboris <strong>consequat nostrud</strong> Lorem irure excepteur incididunt adipisicing id.</p>
<p>Ullamco cillum <strong><em>esse anim dolore</em></strong> duis adipisicing.</p>
<p>Cillum incididunt <strong><em>nostrud sunt occaecat</em></strong> fugiat commodo quis in pariatur exercitation.</p>
<p>Veniam pariatur labore <a href="https://google.com" target="_blank" rel="noopener nofollow noreferrer">consectetur</a> laborum.</p>
<p>Veniam pariatur labore <a href="https://google.com" target="_blank" rel="noopener noreferrer ugc nofollow">consectetur</a> laborum.</p>
<blockquote>
<p>Fugiat consectetur culpa anim enim sit nisi culpa consequat Lorem ipsum.<br><br>Qui proident non pariatur veniam est irure.</p>
</blockquote>
Expand Down
4 changes: 3 additions & 1 deletion src/transformers/md2html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ const formatter = unified()
.use(rehypeRewrite, rehypeRewriteOptions)
.use(rehypeRaw)
.use(rehypeSanitize, rehypeSanitizeOptions)
.use(rehypeExternalLinks, { rel: ['noopener', 'nofollow', 'noreferrer'] })
.use(rehypeExternalLinks, {
rel: ['noopener', 'noreferrer', 'ugc', 'nofollow'],
})
.use(rehypeFormat)
.use(rehypeStringify, rehypeStringifyOptions)

Expand Down
20 changes: 10 additions & 10 deletions src/transformers/normalize.test.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/transformers/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const rehypeRewriteOptions: RehypeRewriteOptions = {
node.properties !== undefined
) {
node.properties.target = '_blank'
node.properties.rel = 'noopener noreferrer nofollow'
node.properties.rel = 'noopener noreferrer ugc nofollow'
}
if (node.type === 'element' && node.tagName === 'del') {
node.tagName = 's'
Expand Down
Loading