Skip to content
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

Obsidian-style foldable callout syntax (e.g. "![Info]- Title") ( Duplicate of #1060) #1070

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

marcchehab
Copy link
Contributor

This adds Obsidian-style foldable callout syntax, as described here: https://help.obsidian.md/Editing+and+formatting/Callouts#Foldable+callouts

Please note that I tested this in my customized Flowershow, so maybe the CSS I added for the padding isn't what you need!

Kind regards from Zurich!

Marc

As promised: A new PR from a branch, so I can mess with my main branch.

Copy link

changeset-bot bot commented Jan 22, 2024

⚠️ No Changeset found

Latest commit: 943866a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jan 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
portaljs-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 4, 2024 9:04pm
site-portaljs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 4, 2024 9:04pm
4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
portaljs-alan-turing ⬜️ Ignored (Inspect) Visit Preview Apr 4, 2024 9:04pm
portaljs-ckan ⬜️ Ignored (Inspect) Visit Preview Apr 4, 2024 9:04pm
portaljs-git-example ⬜️ Ignored (Inspect) Visit Preview Apr 4, 2024 9:04pm
portaljs-learn ⬜️ Ignored (Inspect) Visit Preview Apr 4, 2024 9:04pm

Copy link

vercel bot commented Jan 22, 2024

@marcchehab is attempting to deploy a commit to the Datopian Team on Vercel.

A member of the Team first needs to authorize it.

@olayway
Copy link
Member

olayway commented Feb 1, 2024

Hello @marcchehab! Thank you so much for waiting so patiently for our review! 🙏 🌸 I'll make sure we merge your code ASAP!

As for the missing arrows: they are just not positioned correctly. Since the pseudo-elements are "absolutely" positioned, they need some "relative" ancestor. And so they show up after adding position: relative to .callout-title class.

image

However, as you can see, they are not perfectly centered vertically. This can be fixed with CSS though to achieve this:

image

See my suggestions to your CSS styles.

🏆 Would be nice to have a simple test for this feature in test/remark-callouts.spec.ts, but it's not required.

Overall, great work, and I can't wait to have it shipped! 🚀

packages/remark-callouts/src/lib/Callout.tsx Outdated Show resolved Hide resolved
packages/remark-callouts/styles.css Show resolved Hide resolved
packages/remark-callouts/styles.css Outdated Show resolved Hide resolved
packages/remark-callouts/styles.css Outdated Show resolved Hide resolved
packages/remark-callouts/styles.css Outdated Show resolved Hide resolved
@marcchehab
Copy link
Contributor Author

marcchehab commented Feb 1, 2024

@olayway thanks for your kind corrections 🥳 I'll immediately port those to my main branch 😬 I'll have a look if I can write a testfile, I'll have to figure out how to use mocha with ts.

Btw: Once we merge this, I can ship another PR to correct a bug in callouts (if something in the title inserts a new element, e.g. a bold text, it breaks the title)

@marcchehab
Copy link
Contributor Author

I can't get mocha to run, so I can't write tests... (Among other things I tried to run mocha in packages/remark-callouts, but no success so far, even though its clearly using your .mocharc.yaml)

@olayway
Copy link
Member

olayway commented Feb 2, 2024

I can't get mocha to run, so I can't write tests... (Among other things I tried to run mocha in packages/remark-callouts, but no success so far, even though its clearly using your .mocharc.yaml)

@marcchehab Thank you for giving it a go! Try running this in the root of the repo:

pnpm i
pnpm nx test remark-callouts

@rufuspollock
Copy link
Member

@marcchehab is this good to merge in your opinion? did you managed to make the changes?

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

Successfully merging this pull request may close these issues.

3 participants