8000 Multi-Line Block Quote Syntax for Citations Not Handled · Issue #5 · babyman/tw2md · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Multi-Line Block Quote Syntax for Citations Not Handled #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lucible opened this issue Apr 28, 2022 · 0 comments
Open

Multi-Line Block Quote Syntax for Citations Not Handled #5

lucible opened this issue Apr 28, 2022 · 0 comments

Comments

@lucible
Copy link
Contributor
lucible commented Apr 28, 2022

TiddlyWiki supports adding a citation to multi-line block quotes with the cite element, which Obsidian does not directly support. Currently tw2md eats any citation info that might exist in a tiddler.

How to resolve this is definitely up for discussion since it's not a standard Obsidian feature. Flagging for future users and providing my personal solution below. 🙂


Process the whole array without skipping the last element, and add a check for exactly <<< to remove any closing lines that don't include citation information.

for (String l : block.subList(1, block.size() - 1)) {

for (String l : block.subList(1, block.size())) {
	final ArrayList<String> list = new ArrayList<>();
	list.add(l);
	if (!renderTextBlock(t, list).equals("<<<")) {
		sb.append(("> " + renderTextBlock(t, list)).trim()).append(NL);
	}
}

In the renderTextFragment function, add a line to handle the <<< citation syntax. I wrap the citation text directly in the html element, which displays properly within the block quote element in Obsidian: on its own line with some default cite element CSS formatting.

private String renderTextFragment(Tiddler t, String s, boolean tableRow) {

// handle cited block quotes
s = s.replaceAll("^<<< +(.+$)", "<cite>$1</cite>");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0