is:raw directive.
#114
Closed
natemoo-re
started this conversation in
Proposal
Replies: 1 comment
-
|
A couple related bug, both were hitting issues with KaTeX syntax likely being manipulated before KaTeX got to process it https://github.com/withastro/astro/issues/2325 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Implementation PR
is:rawThe
is:rawdirective instructs the Astro compiler to treat any child content as raw text.This is technically a formalization of the undocumented
data-astro-rawattribute that is used internally. I'm bringing this discussion up here to be transparent about formalizing this previously private API, but I'm not sure if we need to go through the full RFC process for something that already exists but would be renamed.is:rawis particularly useful when non-HTML content (such as KaTeX, Nunjucks, or even PHP) needs to be embedded inside of an Astro file.This feature can be used to emulate Astro's
<script>and<style>behavior in custom components. The compiler ignores everything inside this component until it reaches the closing pair, just like how HTML handles it in <script> or <style>.{expressions}will not be parsed inside ofis:rawblocks, nor will any HTML content.Examples
is:rawis useful for embedding content where{}might be significant characters, such as KaTeX.is:rawcan be used withFragmentto avoid code that would correctly break the Astro compiler, such as an orphaned closing tag.is:rawcan also be used with Component nodes to treat all children as raw text. Paired with a properAstro.slotsAPI (TODO), this could allow preprocessing of content similar to the built-inMarkdowncomponent.Beta Was this translation helpful? Give feedback.
All reactions