Skip to content

Commit 6bf137e

Browse files
committed
fix: false positive pdf link detection for www.pdf* websites
Also update dependencies, add tests coverage, drop yarn in favour of npm, formatting
1 parent df92343 commit 6bf137e

11 files changed

+2787
-758
lines changed

web/.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dist/
2+
3+
package-lock.json
4+
5+
.prettierignore
6+
.prettierrc
7+
.DS_Store

web/.prettierrc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"singleQuote": true,
33
"trailingComma": "all",
44
"bracketSpacing": true,
5-
"jsxBracketSameLine": true,
65
"printWidth": 120,
76
"tabWidth": 2,
87
"useTabs": false,
@@ -26,6 +25,12 @@
2625
"options": {
2726
"parser": "json"
2827
}
28+
},
29+
{
30+
"files": "*.md",
31+
"options": {
32+
"parser": "markdown"
33+
}
2934
}
3035
]
3136
}

web/README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,15 @@ Add this script in the head of your webpage:
4444

4545
_Replace `companyIdentifier` with your own_
4646

47+
<!-- prettier-ignore-start -->
4748
```html
4849
<script
4950
src="https://unpkg.com/@simplepdf/web-embed-pdf"
5051
companyIdentifier="yourcompany"
5152
defer
5253
></script>
5354
```
55+
<!-- prettier-ignore-end -->
5456

5557
## How does it work?
5658

@@ -69,9 +71,7 @@ Exclude any anchor tags from opening SimplePDF by adding the class `exclude-simp
6971
Add a class `simplepdf` to any anchor tag to open them with SimplePDF:
7072

7173
```html
72-
<a href="/example_without_pdf_extension" class="simplepdf"
73-
>Open with SimplePDF</a
74-
>
74+
<a href="/example_without_pdf_extension" class="simplepdf">Open with SimplePDF</a>
7575
```
7676

7777
## Advanced usage
@@ -91,6 +91,7 @@ SimplePDF currently supports the following languages automatically detects the l
9191

9292
**If you wish to override the automatic detection, you can specify the `locale` attribute on the script tag as follows**:
9393

94+
<!-- prettier-ignore-start -->
9495
```html
9596
<script
9697
src="https://unpkg.com/@simplepdf/web-embed-pdf"
@@ -99,13 +100,14 @@ SimplePDF currently supports the following languages automatically detects the l
99100
defer
100101
></script>
101102
```
103+
<!-- prettier-ignore-end -->
102104

103105
### Opening the editor programmatically
104106

105107
#### Open the editor with a specific PDF
106108

107109
```javascript
108-
window.simplePDF.openEditor({ href: "publicly_available_url_pdf" });
110+
window.simplePDF.openEditor({ href: 'publicly_available_url_pdf' });
109111
```
110112

111113
#### Let your customers pick the PDF on their computer
@@ -133,17 +135,18 @@ _Do not store sensitive information in the context (!!) as it is available local
133135

134136
```javascript
135137
window.simplePDF.openEditor({
136-
href: "publicly_available_url_pdf",
138+
href: 'publicly_available_url_pdf',
137139
context: {
138-
customer_id: "123",
139-
environment: "prod",
140+
customer_id: '123',
141+
environment: 'prod',
140142
},
141143
});
142144
```
143145

144146
### Updating the configuration programmatically
145147

146148
**Use-cases:**
149+
147150
- Change the locale at run time
148151
- Enabling / Disabling _Auto Open_: automatically opening the editor for anchor tags pointing to PDF files. By default enabled when SimplePDF is added as a script
149152
- Change the company identifier at run time
@@ -153,4 +156,4 @@ window.simplePDF.setConfig({
153156
locale: 'fr',
154157
autoOpen: false,
155158
});
156-
```
159+
```

0 commit comments

Comments
 (0)