Skip to content

Commit

Permalink
Merge pull request #29 from cristianvasquez/testing-prettier
Browse files Browse the repository at this point in the history
Testing prettier
  • Loading branch information
cristianvasquez authored Dec 30, 2020
2 parents 1257138 + 2f310a7 commit 6be7aa3
Show file tree
Hide file tree
Showing 20 changed files with 450 additions and 217 deletions.
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,31 @@ The default hotkey is `Ctrl+Alt+L`.

## Examples

### Add a frontmatter
### Hashtags janitor

Say you have:

```markdown

A #new and #exciting paragraph!
```

After 'Update fields':

```markdown
---
tags:
- '#new'
- '#exciting'

---

A #new and #exciting paragraph!


```

### Update values in the frontmatter

Before:

Expand Down Expand Up @@ -133,6 +157,11 @@ unzip ~/Downloads/obsidian-prettify-0.1.zip -d $OBSIDIAN_VAULT_DIR/.obsidian/plu

## Version History

### v.0.0.7

- New Refactor tags functionality (ctrl+shift+o)
- Can add emoticons as tags

### v.0.0.6

Fixed frontmatter bug
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"author": "Cristian",
"authorUrl": "https://github.com/cristianvasquez",
"js": "main.js",
"version": "0.0.6"
"version": "0.0.7"
}
22 changes: 6 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "obsidian-obsidian-prettify",
"author": "Cristian",
"license": "GPL-3.0-or-later",
"type": "module",
"bugs": {
"url": "https://github.com/cristianvasquez/obsidian-prettify/issues"
},
Expand All @@ -10,42 +11,31 @@
"main": "index.js",
"scripts": {
"dev": "rollup --config rollup.config.js -w",
"build": "rollup --config rollup.config.js"
"build": "rollup --config rollup.config.js",
"test": "jest"
},
"repository": {
"type": "git",
"url": "git+https://github.com/cristianvasquez/obsidian-prettify.git"
},
"dependencies": {
"@types/unist": "^2.0.0",
"longest-streak": "^2.0.0",
"markdown-utils": "^1.0.0",
"mdast-util-definitions": "^4.0.0",
"mdast-util-to-string": "^1.0.0",
"moment": "^2.29.1",
"npm": "^6.14.8",
"parse-entities": "^2.0.0",
"rehype-katex": "^4.0.0",
"remark-frontmatter": "^3.0.0",
"remark-gfm": "^1.0.0",
"remark-images": "^2.0.0",
"remark-math": "^4.0.0",
"remark-metadata": "^0.2.1",
"remark-images": "^2.0.0",
"remark-parse": "^9.0.0",
"remark-wiki-link": "^1.0.0",
"repeat-string": "^1.0.0",
"unified": "^9.2.0",
"yaml": "1.10.0",
"zwitch": "^1.0.0"
"js-yaml": "git://github.com/nodeca/js-yaml.git#dev",
"zwitch": "^1.0.5"
},
"devDependencies": {
"remark": "^13.0.0",

"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"@rollup/plugin-typescript": "^6.0.0",
"@types/node": "^14.14.2",
"jest": "^26.0.1",
"obsidian": "https://github.com/obsidianmd/obsidian-api/tarball/master",
"rollup": "^2.32.1",
Expand Down
102 changes: 100 additions & 2 deletions src/__tests__/__snapshots__/frontmatter.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,53 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Add quotes 1`] = `
VFile {
"contents": "---
Name:
- '#Hello'
- World
- ' #Hi'
- '#with/tab'
- '#with/tab/teb/tib'
- '#howdy_bla'
- '#howdy-bla'
Other tag: '#Nothing'
tags:
- '#Nothing'
date updated: '2010-06-10T00:20:00+02:00'
---
Outside frontmatter
#tag
",
"cwd": "/home/cvasquez/obsidian/workspace/.obsidian/plugins/markdown-prettifier",
"data": Object {},
"history": Array [],
"messages": Array [],
}
`;

exports[`Adds tags 1`] = `
VFile {
"contents": "---
Name:
- '#Hi'
date updated: '2010-06-10T00:20:00+02:00'
tags:
- '#hello'
- '#world'
---
",
"cwd": "/home/cvasquez/obsidian/workspace/.obsidian/plugins/markdown-prettifier",
"data": Object {},
"history": Array [],
"messages": Array [],
}
`;

exports[`Creates a header 1`] = `
VFile {
"contents": "---
Expand Down Expand Up @@ -46,7 +94,6 @@ VFile {
exports[`Does not modify date 1`] = `
VFile {
"contents": "---
date updated: '1999-06-10T00:20:00+02:00'
---
Expand Down Expand Up @@ -85,13 +132,49 @@ perhaps 1% ? of the humans use it for facts?
}
`;

exports[`Preserve previous tags 1`] = `
VFile {
"contents": "---
tags:
- '#preserve_me'
- '#hello'
- '#world'
date updated: '2010-06-10T00:20:00+02:00'
---
",
"cwd": "/home/cvasquez/obsidian/workspace/.obsidian/plugins/markdown-prettifier",
"data": Object {},
"history": Array [],
"messages": Array [],
}
`;

exports[`Preserve previous tags 2`] = `
VFile {
"contents": "---
date updated: '2010-06-10T00:20:00+02:00'
tags:
- '#literatura'
---
",
"cwd": "/home/cvasquez/obsidian/workspace/.obsidian/plugins/markdown-prettifier",
"data": Object {},
"history": Array [],
"messages": Array [],
}
`;

exports[`Respects emojis 1`] = `
VFile {
"contents": "---
tag: \\"#\\\\U0001F990\\"
tag: '#🦐'
date updated: '2010-06-10T00:20:00+02:00'
---
🦐
",
"cwd": "/home/cvasquez/obsidian/workspace/.obsidian/plugins/markdown-prettifier",
"data": Object {},
Expand All @@ -114,3 +197,18 @@ date updated: '2010-06-10T00:20:00+02:00'
"messages": Array [],
}
`;

exports[`add quote 1`] = `
VFile {
"contents": "---
tag: '#hello'
date updated: '{{date:YYYY-MM-DDTHH:mm:ssZ}}'
---
",
"cwd": "/home/cvasquez/obsidian/workspace/.obsidian/plugins/markdown-prettifier",
"data": Object {},
"history": Array [],
"messages": Array [],
}
`;
11 changes: 0 additions & 11 deletions src/__tests__/__snapshots__/issues.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,3 @@ VFile {
"messages": Array [],
}
`;

exports[`issues https://github.com/cristianvasquez/obsidian-prettify/issues/20 1`] = `
VFile {
"contents": "[[ link | alias]]
",
"cwd": "/home/cvasquez/obsidian/workspace/.obsidian/plugins/markdown-prettifier",
"data": Object {},
"history": Array [],
"messages": Array [],
}
`;
4 changes: 2 additions & 2 deletions src/__tests__/basic.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ test("Indent size", () => {
- foo
- foo
`
return prettifier(content,{listItemIndent:'one'}).then(data => {
return prettifier(content, {listItemIndent: 'one'}).then(data => {
expect(data).toMatchSnapshot();
});
});
Expand All @@ -133,7 +133,7 @@ test("Indent size", () => {
- foo
- foo
`
return prettifier(content,{listItemIndent:'tab'}).then(data => {
return prettifier(content, {listItemIndent: 'tab'}).then(data => {
expect(data).toMatchSnapshot();
});
});
Loading

0 comments on commit 6be7aa3

Please sign in to comment.