diff --git a/README.md b/README.md index 6be8e7e..5d6527c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Markdown Attributes for Obsidian.md -Allows the use of `{: .class id='id' data=value }` markdown attributes inside Obsidian.md. +Allows the use of `{ .class id='id' data=value }` markdown attributes inside Obsidian.md. 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. @@ -8,7 +8,7 @@ This plugin is currently proof of concept; however, no loss of data should occur Add your attributes inside a curly bracket with a colon, like this: -`{: .class }` +`{ .class }` See below for usage with specific elements. @@ -21,7 +21,7 @@ Currently, the ID attribute must be set using `id=value` due to Obsidian's tags. Inline text elements such as italics, bold, highlight, etc. should have their attributes placed _inside_ the symbol: ``` -I'm normal text, but *I'm italic {: class='italics' }*, **I'm bold {: .bold }** and ==I'm highlighted {: id=highlight }==. +I'm normal text, but *I'm italic { class='italics' }*, **I'm bold { .bold }** and ==I'm highlighted { id=highlight }==. ``` ### Paragraphs @@ -32,14 +32,14 @@ Paragraph attributes should be placed after the last line of the block. This is a paragraph. This is another line of the paragraph. This is the last line. -{: id=my_paragraph .class } +{ id=my_paragraph .class } ``` ### Headers Attributes must be added to headers at the end of the line. -`### A Header {: id=header .header-class }` +`### A Header { id=header .header-class }` ### Tables @@ -49,15 +49,15 @@ Attributes can be added to the `` element by placing the attribute on the | header1 | header2 | | ------- | ------- | | column1 | column2 | -{: .table-class} +{ .table-class} ``` Attributes can be added to individual table cells like so: ```markdown -| header1 {: .class} | header2 | +| header1 { .class} | header2 | | ------------------ | ---------------------- | -| column1 | column2 {: .class-two} | +| column1 | column2 { .class-two} | ``` It is not currently possible to add attributes to `` or `` elements. @@ -66,34 +66,34 @@ It is not currently possible to add attributes to `` or `` elements. Both Wikilinks and markdown syntax links may have attributes placed on them. -`[link](http://example.com){: class="foo bar" title="Some title!" }` +`[link](http://example.com){ class="foo bar" title="Some title!" }` -`[[Test 123]] {: .wikilink}` +`[[Test 123]] { .wikilink}` ### Lists Lists may have attributes placed on each individual list item. ```markdown -- item {: .item} - - nested item {: .nested} - - nested item 2 {: id="item 2" } +- item { .item} + - nested item { .nested} + - nested item 2 { id="item 2" } ``` Attributes can only be applied to the final nested list by placing the attribute on the line immediately following the last item. ```markdown -- item 1 {: .item} -- item 2 {: id=item } -- item 3 {: data-item=3 } - {: .top-level-ul } +- item 1 { .item} +- item 2 { id=item } +- item 3 { data-item=3 } + { .top-level-ul } ``` ```markdown -- item {: .item} - - nested item {: .nested} - - nested item 2 {: id="item 2" } - {: .nested-ul} +- item { .item} + - nested item { .nested} + - nested item 2 { id="item 2" } + { .nested-ul} ``` ### Code Blocks @@ -101,7 +101,7 @@ Attributes can only be applied to the final nested list by placing the attribute Code blocks should have their attributes placed after the initial three ticks. ```` -```python {: data-python="code" .class } +```python { data-python="code" .class } nums = [x for x in range(10)] ``` ```` @@ -112,7 +112,7 @@ nums = [x for x in range(10)] # Installation - +- Once installed, close the community plugins window and activate the newly installed plugin ## From GitHub diff --git a/manifest.json b/manifest.json index f39a78e..a34955e 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "markdown-attributes", "name": "Markdown Attributes", - "version": "0.0.7", + "version": "1.0.0", "minAppVersion": "0.12.10", "description": "Add markdown attributes to elements in Obsidian.md", "author": "Jeremy Valentine", diff --git a/package.json b/package.json index a1834ff..86326d9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "markdown-attributes", - "version": "0.0.7", + "version": "1.0.0", "description": "Add markdown attributes to elements in Obsidian.md", "main": "main.js", "scripts": { diff --git a/src/processor.ts b/src/processor.ts index d8c7646..9642cb7 100644 --- a/src/processor.ts +++ b/src/processor.ts @@ -5,8 +5,8 @@ interface ElementWithAttributes { } export default class Processor { - static BASE_RE = /\{\:[ ]*([^\}\n ][^\}\n]*)[ ]*\}/; - static ONLY_RE = /^\{\:[ ]*([^\}\n ][^\}\n]*)[ ]*\}$/; + static BASE_RE = /\{\:?[ ]*([^\}\n ][^\}\n]*)[ ]*\}/; + static ONLY_RE = /^\{\:?[ ]*([^\}\n ][^\}\n]*)[ ]*\}$/; static BLOCK_RE = /\n[ ]*\{\:?[ ]*([^\}\n ][^\}\n]*)[ ]*\}[ ]*$/; constructor(private topLevelElement: HTMLElement) {} diff --git a/versions.json b/versions.json index fd46282..74999dd 100644 --- a/versions.json +++ b/versions.json @@ -1,3 +1,4 @@ { - "0.0.7": "0.12.0" + "0.0.7": "0.12.0", + "1.0.0": "0.12.0" } \ No newline at end of file