Skip to content

Commit cf130f6

Browse files
committed
Merge branch 'macintacos-master' into 0.1.6 close #14
2 parents a88a0f9 + 0e3871f commit cf130f6

File tree

3 files changed

+49
-23
lines changed

3 files changed

+49
-23
lines changed

media/css/confluence.css

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
body {
2-
font-family: "Segoe WPC", "Segoe UI", "SFUIText-Light", "HelveticaNeue-Light", sans-serif, "Droid Sans Fallback";
2+
font-family: -apple-system,
3+
BlinkMacSystemFont,
4+
"Segoe UI",
5+
Roboto,
6+
Helvetica,
7+
Arial,
8+
sans-serif,
9+
"Apple Color Emoji",
10+
"Segoe UI Emoji",
11+
"Segoe UI Symbol";
312
font-size: 14px;
413
padding: 0 26px;
514
line-height: 1em;
@@ -37,7 +46,9 @@ h1 {
3746
border-bottom-style: solid;
3847
}
3948

40-
h1, h2, h3 {
49+
h1,
50+
h2,
51+
h3 {
4152
font-weight: normal;
4253
}
4354

@@ -47,25 +58,31 @@ blockquote {
4758
border-left: 5px solid;
4859
}
4960

50-
table, th, td {
51-
border: 1px solid;
52-
border-collapse: collapse;
61+
table,
62+
th,
63+
td {
64+
border: 1px solid;
65+
border-collapse: collapse;
66+
padding: 7px;
5367
}
5468

55-
pre > code {
69+
pre>code {
5670
display: inline-block;
5771
width: 90%;
5872
color: white;
5973
margin: 0px 5px;
6074
font-size: 14px;
61-
font-family: Menlo, Monaco, Consolas, "Droid Sans Mono", "Courier New", monospace, "Droid Sans Fallback";
62-
background-color:black;
75+
background-color: black;
6376
cursor: pointer;
6477
padding: 5px 1em;
65-
box-shadow: 1px 1px 1px rgba(0,0,0,.25);
78+
box-shadow: 1px 1px 1px rgba(0, 0, 0, .25);
6679
line-height: 1.5em;
6780
}
6881

82+
pre > code > p {
83+
margin: 0px
84+
}
85+
6986
ul {
7087
list-style-type: disc;
7188
}
@@ -77,9 +94,11 @@ ul.alternate {
7794
ol.initial {
7895
list-style: decimal;
7996
}
80-
ol.initial > ol {
97+
98+
ol.initial>ol {
8199
list-style-type: lower-alpha;
82100
}
83-
ol.initial > ol > ol {
101+
102+
ol.initial>ol>ol {
84103
list-style-type: lower-roman;
85-
}
104+
}

package.json

Lines changed: 11 additions & 1 deletion
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.5",
4+
"version": "0.2.0",
55
"publisher": "denco",
66
"description": "Confluence markup language support for Visual Studio Code",
77
"keywords": [
@@ -39,6 +39,16 @@
3939
],
4040
"main": "./out/extension",
4141
"contributes": {
42+
"configuration": {
43+
"title": "Confluence Markup",
44+
"properties": {
45+
"confluenceMarkup.monospaceFont": {
46+
"type": "string",
47+
"default": "Menlo, Monaco, Consolas, monospace",
48+
"description": "This is the value passed to the font-family CSS attribute for code in the preview. Provide it with a monospace font of your choice!"
49+
}
50+
}
51+
},
4252
"languages": [
4353
{
4454
"id": "confluence",

src/markupParser.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as path from 'path';
77
const EXTENTION_ID = 'denco.confluence-markup';
88
const EMOTICON_PATH = '/media/emoticons/';
99
const CSS_PATH = '/media/css/';
10+
const MONOSPACE_FONT_FAMILY = vscode.workspace.getConfiguration("confluenceMarkup").monospaceFont;
1011

1112
function imageUri(searchUri: vscode.Uri, imageLink: string) {
1213
let imageUri
@@ -60,7 +61,7 @@ export function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
6061
tag = tag.replace(/\+([^\+]*)\+/g, "<u>$1</u>");
6162
tag = tag.replace(/\^([^\^]*)\^/g, "<sup>$1</sup>");
6263
tag = tag.replace(/~([^~]*)~/g, "<sub>$1</sub>");
63-
tag = tag.replace(/\{{2}(.*)\}{2}/g, "<code>$1</code>");
64+
tag = tag.replace(/\{{2}(.*)\}{2}/g, `<code style='font-family: ${MONOSPACE_FONT_FAMILY}'>$1</code>`);
6465
tag = tag.replace(/\?{2}(.*)\?{2}/g, "<cite>$1</cite>");
6566
tag = tag.replace(/\{color:(\w+)\}(.*)\{color\}/g, "<span style='color:$1;'>$2</span>");
6667

@@ -122,14 +123,14 @@ export function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
122123
// code
123124
// online code tag
124125
tag = tag.replace(/\{(noformat|code)[^\}]*\}(.*)\{(noformat|code)\}/, function (m0, m1, m2) {
125-
return "<pre><code>" + m2.replace(/</gi, '&lt;') + "</code></pre>";
126+
return `<pre><code style='font-family: ${MONOSPACE_FONT_FAMILY}'>${m2.replace(/</gi, '&lt;')}</code></pre>`;
126127
});
127128

128129
let re = /\{[(code)|(noformat)].*\}/;
129130
let match = tag.match(re);
130131
if (match) {
131132
if (codeTagFlag === 0) {
132-
tag = '<pre><code>';
133+
tag = `<pre><code style='font-family: ${MONOSPACE_FONT_FAMILY}'>`;
133134
codeTagFlag = 1;
134135
} else {
135136
tag = '</pre></code>';
@@ -190,23 +191,19 @@ export function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
190191
tag = tag.replace(/_([\w ]*)_/g, "<i>$1</i>");
191192
}
192193
} else {
193-
if (tag !== '<pre><code>') {
194+
if (tag !== `<pre><code style='font-family: ${MONOSPACE_FONT_FAMILY}'>`) {
194195
tag = tag.replace(/</gi, '&lt;') + '<br />';
195196
}
196197
}
197198

198-
if (tag.match(/^s*$/)) {
199-
tag = '<br />';
200-
}
201-
202199
//close table
203200
if (!tag.match(/<\/tr>$/) && tableFlag) {
204201
tag = '</table>' + tag;
205202
tableFlag = false;
206203
}
207204

208-
result += tag;
205+
result += "<p>" + tag + "</p>";
209206
}
210207

211208
return result;
212-
}
209+
}

0 commit comments

Comments
 (0)