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

Links plugin #32

Open
hagenburger opened this issue Aug 18, 2018 · 0 comments
Open

Links plugin #32

hagenburger opened this issue Aug 18, 2018 · 0 comments
Assignees
Labels
enhancement New feature or request plugin
Milestone

Comments

@hagenburger
Copy link
Owner

hagenburger commented Aug 18, 2018

New feature

Allow links in code blocks. This is useful when there are definitions elsewhere.

Specifications

``` html +link=/class/g:https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class,/my-special-list-item/g:#my-special-list-item
<ul>
  <li class="my-list-item">
    Item 1
  </li>
  <li class="my-list-item my-special-list-item">
    Item 2
  </li>
  <li class="my-list-item">
    Item 3
  </li>
  <li class="my-list-item">
    Item 4
  </li>
</ul>
```

Result:

preview

The following syntax should be valid:

  • +link="xxx":url – link xxx to url
  • +link="xxx":url-a,"yyy":url-b – link multiple strings
  • +link=/xxx/:url – search for RegExp
  • +link=/xxx/g:url – allow modifiers
  • +link=/xxx/:url-a,/yyy/:url-b – allow multiple RegExp
  • +link="xxx":url-a,/yyy/:url-b,/zzz/gi:url-c – mix everything up

Open questions

  • How to escape ", :, ;, and /? → Use JavaScript syntax
  • Should " and ' be allowed? → No, use JSON syntax
  • Maybe /class=".*(my-class).*"/ could link my-class only (as in the group). This could be useful for linkin the tag name of li in <li class="list-item"> but not within list-item. Background: Look ahead/behind in JavaScript’s RegExp are not supported well and hard to read/write. Using a group could be much more easy.

→ This is not optimal yet as it results in long lines. Maybe another solution could be better.

@hagenburger hagenburger added enhancement New feature or request plugin labels Aug 18, 2018
@hagenburger hagenburger added this to the v1.0.0 milestone Aug 18, 2018
@hagenburger hagenburger self-assigned this Aug 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugin
Projects
None yet
Development

No branches or pull requests

1 participant