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

add list of valid context names to findBy docs #1414

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

Conversation

StarfallProjects
Copy link

Proposal: add a list of valid context names to the findBy docs. I've added all the names I've found so far. However, if this docs repo PR is accepted (asciidoctor/asciidoc-docs#90), it might be nicer to just add a link to the docs, rather than maintain the list in two places.

@ggrossetie
Copy link
Member

@mojavelinux What do you think? Should we link to the documentation https://docs.asciidoctor.org/asciidoc/latest/blocks/#summary-of-built-in-contexts?

It might be confusing since Asciidoctor is using keyword :paragraph whereas Asciidoctor.js is using string...

Thoughts? 🤔

@mojavelinux
Copy link
Member

Yes, I think we should link to the official list. As for the type (symbol or string) I think that can be clarified on both ends. I keep thinking to myself that that list should show strings, not symbols. Then we can explain elsewhere (such as in Asciidoctor) when a symbol is required. If you have suggestions for where to make those changes, I'm prepared to apply them.

@ggrossetie
Copy link
Member

Then we can explain elsewhere (such as in Asciidoctor) when a symbol is required. If you have suggestions for where to make those changes, I'm prepared to apply them.

@mojavelinux Yes, that's a good idea. The implementation (Ruby) should state that context names should be passed as symbol. We could add a reference here: https://docs.asciidoctor.org/asciidoctor/latest/convert/templates/#backing-data-model

Although, this information is also useful when developping an extension, for instance here: https://docs.asciidoctor.org/asciidoctor/latest/extensions/block-processor/

on_context :paragraph

Or when using the find_by method.

Anyway, I think the "Backing data model" section is where we could introduce this concept.
If we want to expand on that concept, we could talk about the following (related) methods:

@mojavelinux
Copy link
Member

I agree that when we're talking about the Ruby API, it should say there that the context must be passed as a symbol. We could also state on the Convertible Context page that whenever the context is used in the Ruby API, it must be a symbol, but AsciidoctorJ and Asciidoctor.js expect a string.

Copy link
Member

@ggrossetie ggrossetie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StarfallProjects I left a comment and we should also update the documentation of findBy for the TypeScript types definition in:

findBy(selector: Selector | ((block: AbstractBlock) => boolean | string)): AbstractBlock[];

@ggrossetie ggrossetie changed the base branch from master to main December 4, 2021 15:08
StarfallProjects and others added 4 commits October 31, 2022 18:34
Proposal: add a list of valid context names to the findBy docs. I've added all the names I've found so far. However, if this docs repo PR is accepted (asciidoctor/asciidoc-docs#90), it might be nicer to just add a link to the docs, rather than maintain the list in two places.
@ggrossetie ggrossetie force-pushed the StarfallProjects-findby-context branch from 2259c61 to c207e31 Compare October 31, 2022 17:34
@ggrossetie ggrossetie self-requested a review October 31, 2022 17:34
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.

None yet

3 participants