Skip to content

Commit

Permalink
Update getting-started.md
Browse files Browse the repository at this point in the history
  • Loading branch information
alselawi committed Apr 3, 2020
1 parent 485a19a commit e6d4ac4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ or download the single file compiled version from [the github repository](https:
```javascript
// If you're using NPM/Yarn, then you need
// to require the library first
const anchorme = require("anchorme"); // like this
const anchorme = require("anchorme").default; // like this
import anchorme from "anchorme"; // or this

// the library will export a single function
Expand All @@ -26,24 +26,24 @@ const resultC = anchorme({
options: {
attributes: {
target: "_blank",
class: "detected"
}
class: "detected",
},
},
// and extensions
extensions: [
// an extension for hashtag search
{
test: /#(\w|_)+/gi,
transform: string =>
`<a href="https://a.b?s=${string.substr(1)}">${string}</a>`
transform: (string) =>
`<a href="https://a.b?s=${string.substr(1)}">${string}</a>`,
},
// an extension for mentions
{
test: /@(\w|_)+/gi,
transform: string =>
`<a href="https://a.b/${string.substr(1)}">${string}</a>`
}
]
transform: (string) =>
`<a href="https://a.b/${string.substr(1)}">${string}</a>`,
},
],
});
```

Expand Down

0 comments on commit e6d4ac4

Please sign in to comment.