Skip to content

Commit

Permalink
Merge pull request #450 from pjkaufman/master
Browse files Browse the repository at this point in the history
Bug: Fix Issue with YAML Title Value Being first Link Text Instead of Heading when H1 Preceeded by Link
  • Loading branch information
pjkaufman committed Oct 12, 2022
2 parents 9dc87c7 + 05122e4 commit 5348abc
Show file tree
Hide file tree
Showing 12 changed files with 825 additions and 1,131 deletions.
21 changes: 21 additions & 0 deletions __tests__/yaml-title-alias.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1017,5 +1017,26 @@ ruleTest({
fileName: 'Filename',
},
},
{ // accounts for https://github.com/platers/obsidian-linter/issues/449
testName: 'Make sure that links in headings are properly copied to the yaml when there is a link prior to the first H1',
before: dedent`
[[Link1]]
# [[Heading]]
`,
after: dedent`
---
aliases:
- '[[Heading]]'
linter-yaml-title-alias: '[[Heading]]'
---
[[Link1]]
# [[Heading]]
`,
options: {
yamlAliasesSectionStyle: 'Multi-line array',
},
},
],
});
16 changes: 16 additions & 0 deletions __tests__/yaml-title.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,21 @@ ruleTest({
# Very long title 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
`,
},
{ // similar to https://github.com/platers/obsidian-linter/issues/449
testName: 'Make sure that links in headings are properly copied to the yaml when there is a link prior to the first H1',
before: dedent`
[[Link1]]
# [[Heading]]
`,
after: dedent`
---
title: '[[Heading]]'
---
[[Link1]]
# [[Heading]]
`,
},
],
});
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
plugins: [
['@babel/plugin-proposal-decorators', {version: 'legacy'}],
['@babel/plugin-proposal-class-properties'],
['@babel/plugin-proposal-private-methods'],
['import-glob'],
],
};
7 changes: 5 additions & 2 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ esbuild.build({
...builtins],
format: 'cjs',
watch: !prod,
target: 'es2018',
target: 'es2020',
sourcemap: prod ? false : 'inline',
minify: prod,
treeShaking: true,
Expand All @@ -53,16 +53,19 @@ esbuild.build({
'import {moment} from \'obsidian\';': 'import moment from \'moment\';',
// remove the use of obsidian in the options to allow for docs.js to run
'import {Setting} from \'obsidian\';': '',
// remove the use of obsidian in settings helper to allow for dovs.js to run
'import {MarkdownRenderer} from \'obsidian\';': '',
},
delimiters: ['', ''],
}),
],
bundle: true,
external: [
'obsidian',
...builtins],
format: 'cjs',
watch: !prod,
target: 'es2018',
target: 'es2020',
sourcemap: prod ? false : 'inline',
treeShaking: true,
outfile: 'docs.js',
Expand Down
Loading

0 comments on commit 5348abc

Please sign in to comment.