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

Support for variable replacement? #646

Closed
danishin opened this issue Aug 15, 2015 · 5 comments
Closed

Support for variable replacement? #646

danishin opened this issue Aug 15, 2015 · 5 comments

Comments

@danishin
Copy link

Is there a way to insert dynamic variables into the parser and replace placeholders in .md?

If not, is there a plan for the support in the future?

Thanks.

Great library btw 🎉 🎉

@joshbruce
Copy link
Member

Closing as stale.

Flagged as a proposal for future consideration once we get beyond fixing known defects. See #1106

@umdstu
Copy link

umdstu commented Sep 9, 2022

Can this be revisited now that #1106 is closed?

@UziTech
Copy link
Member

UziTech commented Sep 9, 2022

@umdstu If you create a new issue with more explanation we would be interested in this. This could most likely be implemented by using an custom extension.

@umdstu
Copy link

umdstu commented Sep 9, 2022 via email

@calculuschild
Copy link
Contributor

calculuschild commented Sep 9, 2022

If you plan to make a custom extension, here's some possible inspiration: I think it's been proposed elsewhere on the interwebs to make use of the existing RefLink syntax for simple string replacement, since RefLinks are essentially just a "fancier" version of a placeholder variable. I.e.:

My name is [name].

[name] : Bob the builder

although you would need some way to identify whether the variable is a URL or just text. GitHub does a similar thing with Footnotes although they use a special token ^ to mark the difference between a footnote and a link. [^1] : Footnote 1

I have been thinking about a similar extension for my own project, and we've been looking at just using quotes:

My name is [name].
This is not a variable but a [link].

[name] : "Bob the builder"
[link] : www.google.com "Google"

I don't know how deep you would want to get into recursive markdown parsing or nested variables or anything:

My name is [name].

[name] : "Bob the **builder** of [structure]."
[structure] : "bridges"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants