Skip to content

Commit

Permalink
Fix #953; Tag to bottom of card interferes with new Dataview function…
Browse files Browse the repository at this point in the history
…ality
  • Loading branch information
mgmeyers committed May 22, 2024
1 parent d018888 commit 19c0ce6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/parsers/formats/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ export function listItemToItemData(stateManager: StateManager, md: string, item:
visit(
item,
['text', 'wikilink', 'embedWikilink', 'image', 'inlineCode', 'code', 'hashtag'],
(node: any) => {
(node: any, i, parent) => {
if (node.type === 'hashtag') {
titleSearch += ' #' + node.value;
if (!parent.children.first()?.value?.startsWith('```')) {
titleSearch += ' #' + node.value;
}
} else {
titleSearch += node.value || node.alt || '';
}
Expand Down Expand Up @@ -111,15 +113,18 @@ export function listItemToItemData(stateManager: StateManager, md: string, item:
(node) => {
return node.type !== 'paragraph';
},
(node) => {
(node, i, parent) => {
const genericNode = node as ValueNode;

if (genericNode.type === 'blockid') {
itemData.blockId = genericNode.value;
return true;
}

if (genericNode.type === 'hashtag') {
if (
genericNode.type === 'hashtag' &&
!(parent.children.first() as any)?.value?.startsWith('```')
) {
if (!itemData.metadata.tags) {
itemData.metadata.tags = [];
}
Expand Down

0 comments on commit 19c0ce6

Please sign in to comment.