Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not add target blank to urls that start with # in markdown #235

Conversation

ResuBaka
Copy link
Contributor

Description

Currently it is not possible to add internal links starting with # as those get target=_blank added.

Additional context

#234


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • If it's a new feature, provide a convincing reason to add it. Ideally, you should open a suggestion issue first and have it approved before working on it.
  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@netlify
Copy link

netlify bot commented Aug 11, 2022

Deploy Preview for histoire-controls ready!

Name Link
🔨 Latest commit 8230222
🔍 Latest deploy log https://app.netlify.com/sites/histoire-controls/deploys/62f50a7804c0bd0009575ae0
😎 Deploy Preview https://deploy-preview-235--histoire-controls.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Aug 11, 2022

Deploy Preview for histoire-site ready!

Name Link
🔨 Latest commit 8230222
🔍 Latest deploy log https://app.netlify.com/sites/histoire-site/deploys/62f50a78d0b6320009d23425
😎 Deploy Preview https://deploy-preview-235--histoire-site.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@ResuBaka ResuBaka force-pushed the fix-remove-target-blank-for-links-starting-with-# branch from 2ad0d63 to 7e14068 Compare August 11, 2022 11:30
@netlify
Copy link

netlify bot commented Aug 11, 2022

Deploy Preview for histoire-examples-vue3 ready!

Name Link
🔨 Latest commit 8230222
🔍 Latest deploy log https://app.netlify.com/sites/histoire-examples-vue3/deploys/62f50a78d0b6320009d23428
😎 Deploy Preview https://deploy-preview-235--histoire-examples-vue3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@ResuBaka
Copy link
Contributor Author

ResuBaka commented Aug 11, 2022

I could not run the code directly.

I have tested it in our Project where I have found it with editing the code in node_modules directly.

Here the issue that I have locally when I tried to run the code.

Nodejs: 16.16.0 pnpm: 7.9.0

pnpm run watch
.....
packages/histoire-plugin-nuxt build$ rimraf dist && tsc -d
│ src/index.ts(71,31): error TS2345: Argument of type '{ configFile?: string | false; envFile?: false; root?: string; base?: string; publicDir?: string | false; cacheDir?: string; mode?: string; define?: Record<string, any>; plugins?: PluginOption[]; .
│   Type '{ configFile?: string | false; envFile?: false; root?: string; base?: string; publicDir?: string | false; cacheDir?: string; mode?: string; define?: Record<string, any>; plugins?: PluginOption[]; ... 19 more ...; histoire?: Partial<...>; }' i
│     Types of property 'plugins' are incompatible.
│       Type 'import("/home/resubaka/code/histoire/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/index").PluginOption[]' is not assignable to type 'import("/home/resubaka/code/histoire/node_modules/.pnpm/[email protected]/node_modules/vite/dist/n
└─ Failed in 4.2s
packages/histoire-plugin-percy build$ rimraf dist && tsc -d
└─ Done in 3s
packages/histoire-plugin-screenshot build$ rimraf dist && tsc -d
└─ Done in 2.8s
packages/histoire-plugin-vue build$ rimraf dist && vite build && pnpm run build:types
[14 lines collapsed]
│ dist/bundled/client/app/RouterLinkStub.js                                   0.92 KiB / gzip: 0.46 KiB
│ dist/bundled/node_modules/.pnpm/[email protected]/node_modules/case/dist/Case.js   5.79 KiB / gzip: 1.78 KiB
│ dist/bundled/client/app/global-components.js                                2.61 KiB / gzip: 0.84 KiB
│ dist/bundled/_virtual/_commonjsHelpers.js                                   1.42 KiB / gzip: 0.58 KiB
│ dist/bundled/_virtual/Case.js                                               0.05 KiB / gzip: 0.06 KiB
│ dist/bundled/client/app/util.js                                             2.68 KiB / gzip: 0.67 KiB
│ dist/bundled/client/app/Story.js                                            2.52 KiB / gzip: 0.87 KiB
│ dist/bundled/client/app/Variant.js                                          1.44 KiB / gzip: 0.54 KiB
│ > @histoire/[email protected] build:types /home/resubaka/code/histoire/packages/histoire-plugin-vue
│ > tsc --declaration --emitDeclarationOnly
└─ Running...
packages/histoire-plugin-vue2 build$ rimraf dist && vite build && pnpm run build:types
[12 lines collapsed]
│ dist/bundled/client/server/Story.js                                         2.13 KiB / gzip: 0.78 KiB
│ dist/bundled/client/server/Variant.js                                       0.81 KiB / gzip: 0.34 KiB
│ dist/bundled/_virtual/_commonjsHelpers.js                                   1.42 KiB / gzip: 0.58 KiB
│ dist/bundled/_virtual/Case.js                                               0.05 KiB / gzip: 0.06 KiB
│ dist/bundled/client/app/RouterLinkStub.js                                   0.64 KiB / gzip: 0.30 KiB
│ dist/bundled/node_modules/.pnpm/[email protected]/node_modules/case/dist/Case.js   5.79 KiB / gzip: 1.78 KiB
│ dist/bundled/client/app/global-components.js                                3.36 KiB / gzip: 1.06 KiB
│ dist/bundled/client/app/util.js                                             2.80 KiB / gzip: 0.69 KiB
│ dist/bundled/client/app/Story.js                                            3.01 KiB / gzip: 0.98 KiB
│ dist/bundled/client/app/Variant.js                                          1.56 KiB / gzip: 0.56 KiB
└─ Running...
/home/resubaka/code/histoire/packages/histoire-plugin-nuxt:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @histoire/[email protected] build: `rimraf dist && tsc -d`
Exit status 2
 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.

Do I need/should run all the task manual and just do not run the nuxt plugin for now as it looks like there is a problem.

@Akryum
Copy link
Member

Akryum commented Aug 11, 2022

I could not run the code directly.

Could you rebase with main?

@ResuBaka ResuBaka force-pushed the fix-remove-target-blank-for-links-starting-with-# branch from 7e14068 to 53885d2 Compare August 11, 2022 12:43
@ResuBaka
Copy link
Contributor Author

After the rebase it works now.

Should I add a new Story with only Markdown and a Link that links to a h1 on the page for example as a test?

@Akryum
Copy link
Member

Akryum commented Aug 11, 2022

Sure!

@ResuBaka
Copy link
Contributor Author

Added a small story and test.

@ResuBaka ResuBaka force-pushed the fix-remove-target-blank-for-links-starting-with-# branch from 5810b22 to 8230222 Compare August 11, 2022 13:56
@Akryum Akryum merged commit 4abb77f into histoire-dev:main Aug 12, 2022
@ResuBaka ResuBaka deleted the fix-remove-target-blank-for-links-starting-with-# branch August 12, 2022 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants