Skip to content

Commit 246d575

Browse files
committed
1.0.0
- Plugin released to community plugin list - Removed requirement to have the colon inside the parameters
1 parent 495eb4f commit 246d575

File tree

5 files changed

+30
-29
lines changed

5 files changed

+30
-29
lines changed

README.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Markdown Attributes for Obsidian.md
22

3-
Allows the use of `{: .class id='id' data=value }` markdown attributes inside Obsidian.md.
3+
Allows the use of `{ .class id='id' data=value }` markdown attributes inside Obsidian.md.
44

55
This plugin is currently proof of concept; however, no loss of data should occur. It is possible that rendering errors may happen. If so, please create an issue including the source text that caused the issue.
66

77
## Using the Plugin
88

99
Add your attributes inside a curly bracket with a colon, like this:
1010

11-
`{: .class }`
11+
`{ .class }`
1212

1313
See below for usage with specific elements.
1414

@@ -21,7 +21,7 @@ Currently, the ID attribute must be set using `id=value` due to Obsidian's tags.
2121
Inline text elements such as italics, bold, highlight, etc. should have their attributes placed _inside_ the symbol:
2222

2323
```
24-
I'm normal text, but *I'm italic {: class='italics' }*, **I'm bold {: .bold }** and ==I'm highlighted {: id=highlight }==.
24+
I'm normal text, but *I'm italic { class='italics' }*, **I'm bold { .bold }** and ==I'm highlighted { id=highlight }==.
2525
```
2626

2727
### Paragraphs
@@ -32,14 +32,14 @@ Paragraph attributes should be placed after the last line of the block.
3232
This is a paragraph.
3333
This is another line of the paragraph.
3434
This is the last line.
35-
{: id=my_paragraph .class }
35+
{ id=my_paragraph .class }
3636
```
3737

3838
### Headers
3939

4040
Attributes must be added to headers at the end of the line.
4141

42-
`### A Header {: id=header .header-class }`
42+
`### A Header { id=header .header-class }`
4343

4444
### Tables
4545

@@ -49,15 +49,15 @@ Attributes can be added to the `<table>` element by placing the attribute on the
4949
| header1 | header2 |
5050
| ------- | ------- |
5151
| column1 | column2 |
52-
{: .table-class}
52+
{ .table-class}
5353
```
5454

5555
Attributes can be added to individual table cells like so:
5656

5757
```markdown
58-
| header1 {: .class} | header2 |
58+
| header1 { .class} | header2 |
5959
| ------------------ | ---------------------- |
60-
| column1 | column2 {: .class-two} |
60+
| column1 | column2 { .class-two} |
6161
```
6262

6363
It is not currently possible to add attributes to `<tr>` or `<thead>` elements.
@@ -66,42 +66,42 @@ It is not currently possible to add attributes to `<tr>` or `<thead>` elements.
6666

6767
Both Wikilinks and markdown syntax links may have attributes placed on them.
6868

69-
`[link](http://example.com){: class="foo bar" title="Some title!" }`
69+
`[link](http://example.com){ class="foo bar" title="Some title!" }`
7070

71-
`[[Test 123]] {: .wikilink}`
71+
`[[Test 123]] { .wikilink}`
7272

7373
### Lists
7474

7575
Lists may have attributes placed on each individual list item.
7676

7777
```markdown
78-
- item {: .item}
79-
- nested item {: .nested}
80-
- nested item 2 {: id="item 2" }
78+
- item { .item}
79+
- nested item { .nested}
80+
- nested item 2 { id="item 2" }
8181
```
8282

8383
Attributes can only be applied to the final nested list by placing the attribute on the line immediately following the last item.
8484

8585
```markdown
86-
- item 1 {: .item}
87-
- item 2 {: id=item }
88-
- item 3 {: data-item=3 }
89-
{: .top-level-ul }
86+
- item 1 { .item}
87+
- item 2 { id=item }
88+
- item 3 { data-item=3 }
89+
{ .top-level-ul }
9090
```
9191

9292
```markdown
93-
- item {: .item}
94-
- nested item {: .nested}
95-
- nested item 2 {: id="item 2" }
96-
{: .nested-ul}
93+
- item { .item}
94+
- nested item { .nested}
95+
- nested item 2 { id="item 2" }
96+
{ .nested-ul}
9797
```
9898

9999
### Code Blocks
100100

101101
Code blocks should have their attributes placed after the initial three ticks.
102102

103103
````
104-
```python {: data-python="code" .class }
104+
```python { data-python="code" .class }
105105
nums = [x for x in range(10)]
106106
```
107107
````
@@ -112,7 +112,7 @@ nums = [x for x in range(10)]
112112

113113
# Installation
114114

115-
<!-- ## From within Obsidian
115+
## From within Obsidian
116116

117117
From Obsidian v0.9.8, you can activate this plugin within Obsidian by doing the following:
118118

@@ -121,7 +121,7 @@ From Obsidian v0.9.8, you can activate this plugin within Obsidian by doing the
121121
- Click Browse community plugins
122122
- Search for this plugin
123123
- Click Install
124-
- Once installed, close the community plugins window and activate the newly installed plugin -->
124+
- Once installed, close the community plugins window and activate the newly installed plugin
125125

126126
## From GitHub
127127

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "markdown-attributes",
33
"name": "Markdown Attributes",
4-
"version": "0.0.7",
4+
"version": "1.0.0",
55
"minAppVersion": "0.12.10",
66
"description": "Add markdown attributes to elements in Obsidian.md",
77
"author": "Jeremy Valentine",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "markdown-attributes",
3-
"version": "0.0.7",
3+
"version": "1.0.0",
44
"description": "Add markdown attributes to elements in Obsidian.md",
55
"main": "main.js",
66
"scripts": {

src/processor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ interface ElementWithAttributes {
55
}
66

77
export default class Processor {
8-
static BASE_RE = /\{\:[ ]*([^\}\n ][^\}\n]*)[ ]*\}/;
9-
static ONLY_RE = /^\{\:[ ]*([^\}\n ][^\}\n]*)[ ]*\}$/;
8+
static BASE_RE = /\{\:?[ ]*([^\}\n ][^\}\n]*)[ ]*\}/;
9+
static ONLY_RE = /^\{\:?[ ]*([^\}\n ][^\}\n]*)[ ]*\}$/;
1010
static BLOCK_RE = /\n[ ]*\{\:?[ ]*([^\}\n ][^\}\n]*)[ ]*\}[ ]*$/;
1111

1212
constructor(private topLevelElement: HTMLElement) {}

versions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"0.0.7": "0.12.0"
2+
"0.0.7": "0.12.0",
3+
"1.0.0": "0.12.0"
34
}

0 commit comments

Comments
 (0)