Skip to content

Commit bdf3c3b

Browse files
authored
Merge pull request #35 from denco/feature/0.1.12
feature/0.1.12
2 parents 715f821 + dd1c6aa commit bdf3c3b

File tree

6 files changed

+63
-33
lines changed

6 files changed

+63
-33
lines changed

.github/workflows/cd.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ on:
77
# types:
88
# - completed
99
push:
10+
branches:
11+
- "!*"
1012
tags:
11-
- "*"
13+
- '[0-9]+.[0-9]+.[0-9]+'
14+
# - "*"
1215
# https://stackoverflow.com/questions/58457140/dependencies-between-workflows-on-github-actions
1316
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_run
14-
# https://github.com/actions/create-release
1517

1618
jobs:
1719
publish:
@@ -25,6 +27,23 @@ jobs:
2527
node-version: 14.x
2628
- name: Install Dependencies
2729
run: npm ci
30+
- name: Build extension package
31+
run: npm run build
32+
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions
33+
- name: Get release version
34+
run: echo "::set-output name=version::${GITHUB_REF#refs/*/}
35+
id: release-version
36+
- name: Create release notes for version ${{ steps.release-version.outputs.version }}
37+
run: npm run --silent changelog > RELEASE_NOTES_${{ steps.release-version.outputs.version }}.md
38+
# https://github.com/ncipollo/release-action
39+
- name: Create github release
40+
uses: ncipollo/release-action@v1
41+
with:
42+
name: ${{ steps.release-version.outputs.version }}
43+
artifact: "confluence-markup-${{ steps.release-version.outputs.version }}.vsix"
44+
artifactContentType: application/zip
45+
bodyFile: "RELEASE_NOTES_${{ steps.release-version.outputs.version }}.md"
46+
token: ${{ secrets.GITHUB_TOKEN }}
2847
- name: Publish to Visual Studio Marketplace
2948
run: ./node_modules/.bin/vsce publish -p ${{ secrets.VSCE_PAT }}
3049
- name: Publish to Open VSX Registry

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Confluence Wiki Markup
22

3+
## [0.1.12](https://github.com/denco/vscode-confluence-markup/releases/tag/0.1.12)
4+
5+
- fix monospace with digits [Monospaced Text does not seem to be supported](https://github.com/denco/vscode-confluence-markup/issues/34)
6+
- add check for undefined panel and webview
7+
- fix regex for line-through and italic formats
8+
39
## [0.1.11](https://github.com/denco/vscode-confluence-markup/releases/tag/0.1.11)
410

511
- enchange color macro with support for rgb and hex colors [Support to {color:}](https://github.com/denco/vscode-confluence-markup/issues/32)

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "confluence-markup",
33
"displayName": "Confluence markup",
4-
"version": "0.1.11",
4+
"version": "0.1.12",
55
"publisher": "denco",
66
"description": "Confluence markup language support for Visual Studio Code",
77
"keywords": [
@@ -121,6 +121,7 @@
121121
}
122122
},
123123
"scripts": {
124+
"build": "npm run package",
124125
"vscode:prepublish": "npm run compile",
125126
"compile": "tsc -p ./",
126127
"watch": "tsc -watch -p ./",
@@ -132,7 +133,8 @@
132133
"prepackage": "npm run clean && npm run compile",
133134
"package": "vsce package",
134135
"clean": "rimraf -rf ./out",
135-
"clean-all": "rimraf -f ./confluence-markup*.vsix; rimraf -rf ./.vscode-test; rimraf -rf ./out; rimraf -rf ./node_modules"
136+
"clean:all": "rimraf -f ./confluence-markup*.vsix; rimraf -rf ./.vscode-test; rimraf -rf ./out; rimraf -rf ./node_modules",
137+
"changelog": "if [ $((grep \"$(grep -m1 'version' package.json | cut -d '\"' -f 4)\" -n CHANGELOG.md || echo 0) | cut -d ':' -f 1) -eq 3 ]; then awk '/##/{++c;next} c==1' CHANGELOG.md | awk '!/^$/'; else >&2 echo 'Unchecked version'; exit 1; fi"
136138
},
137139
"devDependencies": {
138140
"@types/glob": "^7.1.1",

src/extension.ts

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,34 @@ import { cssUri } from './markupParser';
1212

1313
function getRenderedContent(contentProvider: ConfluenceContentProvider, uri: vscode.Uri, panel: vscode.WebviewPanel) {
1414
contentProvider.provideTextDocumentContent(packConfluenceUri(uri)).then((renderedContent) => {
15-
// Security
16-
// https://code.visualstudio.com/api/extension-guides/webview#security
17-
18-
const cssFile = cssUri('confluence.css')
19-
let cssLink = ""
20-
if (cssFile) {
21-
const cssUrl = panel.webview.asWebviewUri(cssFile)
22-
cssLink = `<link rel="stylesheet" href="${cssUrl}">`
23-
}
15+
if (panel && panel.webview) {
16+
// Security
17+
// https://code.visualstudio.com/api/extension-guides/webview#security
18+
19+
const cssFile = cssUri('confluence.css')
20+
let cssLink = ""
21+
if (cssFile) {
22+
const cssUrl = panel.webview.asWebviewUri(cssFile)
23+
cssLink = `<link rel="stylesheet" href="${cssUrl}">`
24+
}
2425

25-
panel.webview.html = `<!DOCTYPE html>
26-
<html>
27-
<head>
28-
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
29-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
30-
<meta http-equiv="Content-Security-Policy"
31-
content="default-src 'none';
32-
img-src self vscode-resource: https:;
33-
script-src self vscode-resource:;
34-
style-src 'unsafe-inline' self vscode-resource:;"/>
35-
${cssLink}
36-
</head>
37-
<body>
38-
${renderedContent}
39-
</body>
40-
</html>`;
26+
panel.webview.html = `<!DOCTYPE html>
27+
<html>
28+
<head>
29+
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
30+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
31+
<meta http-equiv="Content-Security-Policy"
32+
content="default-src 'none';
33+
img-src self vscode-resource: https:;
34+
script-src self vscode-resource:;
35+
style-src 'unsafe-inline' self vscode-resource:;"/>
36+
${cssLink}
37+
</head>
38+
<body>
39+
${renderedContent}
40+
</body>
41+
</html>`;
42+
}
4143
}, (reason) => {
4244
vscode.window.showErrorMessage(reason);
4345
});

src/markupParser.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,10 @@ export function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
285285
tag = tag.replace(/\*([^*]*)\*/g, "<strong>$1</strong>");
286286
// line-through
287287
if ((!html_tag) && (!tag.match('<img')) && (!listFlag)) {
288-
tag = tag.replace(/\B-([^-]*)-\B/g, " <span style='text-decoration: line-through;'>$1</span> ");
289-
tag = tag.replace(/_([^_]*)_/g, "<i>$1</i>");
288+
// tag = tag.replace(/\B-([^-]*)-\B/g, " <span style='text-decoration: line-through;'>$1</span> ");
289+
// tag = tag.replace(/_([^_]*)_/g, "<i>$1</i>");
290+
tag = tag.replace(/\B-((\([^)]*\)|{[^}]*}|\[[^]]+\]){0,3})(\S.*?\S|\S)-\B/g," <span style='text-decoration: line-through;'>$3</span> ");
291+
tag = tag.replace(/(?:\b)_((\([^)]*\)|{[^}]*}|\[[^]]+\]){0,3})(\S.*?\S|\S)_(?:\b)/g, "<i>$3</i>");
290292
}
291293
} else {
292294
if (tag !== `<pre><code style='font-family: ${MONOSPACE_FONT_FAMILY}'>`) {

src/test/suite/fixtures/expected/test.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ <h2>
129129
<i>emphasis</i>
130130
</p>
131131
<p>
132-
<i>italics</i>: Thing
133-
<i>x</i>
132+
<i>italics</i>: Thing_x_
134133
</p>
135134
<p>
136135
<i>italics with spaces</i>

0 commit comments

Comments
 (0)