Open awcodes opened 1 year ago
testing note: when using torchlight-cli on javascript code <pre><code data-language='js'></code></pre>
, the $
character works as expected (so this problem might be language specific)
Thanks for the reply. Are there any know caveats with mdx? I'm getting the issue in Astro with mdx.
Here's the output html it's running against:
<pre><code class="language-php">use Filament\Forms\Components\TextInput;
TextInput::make('cost')->mask(fn (TextInput\Mask $mask) => $mask->money(prefix: '$', thousandsSeparator: ',', decimalPlaces: 2))
</code></pre>
<p>You can also control whether the number is signed or not. While the default is to allow both negative and positive numbers, <code>isSigned: false</code> allows only positive numbers:</p>
<pre><code class="language-php">use Filament\Forms\Components\TextInput;
TextInput::make('cost')->mask(fn (TextInput\Mask $mask) => $mask->money(prefix: '$', thousandsSeparator: ',', decimalPlaces: 2, isSigned: false))
</code></pre>
<h3 id="datalists">Datalists</h3>
<p>You may specify <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist">datalist</a> options for a text input using the <code>datalist()</code> method:</p>
<pre><code class="language-php">TextInput::make('manufacturer')
->datalist([
'BWM',
'Ford',
'Mercedes-Benz',
'Porsche',
'Toyota',
'Tesla',
'Volkswagen',
])
</code></pre>
Hey again @awcodes.
Just to confirm, are you providing torchlight-cli an html file (output from astro), or mdx? If you are providing it mdx, the remark-torchlight package might be better.
I am still testing this myself, but here is what I've learned so far. Maybe something will be useful:
.md
files! So this could work for your Astro site. Are you using any unified or remark plugins already?.mdx
files (not being able to add components to markdown files is a real problem!). After reading .mdx documentation, I see that it uses a slightly different Abstract Syntax Tree than regular .md
files. Regular .md
uses mast
(markdown abstract syntax tree); whereas .mdx
uses mdast
, which is an extension of mast
. Though, I think it might be as simple as adding this remark-mdx plugin to the unified chain!Sorry I don't have a better answer yet, but I will let you know as soon as I test this remark-mdx plugin. Within the next few days.
Yea. I'm running it after the build against the dist html files.
Also ran into the same issue you did with nextjs.
Also just kinda want to run it after the build so it's not possibly getting throttled during dev with hmr, etc.
Thanks for taking the time to help though.
+1 on this is anyone can find a solution.
For clarification, it's not $
, its ('$')
as a combination
When having code blocks that have '$' in them the CLI run breaks and causes unexpected output in the html file.