-
Notifications
You must be signed in to change notification settings - Fork 245
Syntax Error encountered in render-inline.js when rendering markdown file #548
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
Comments
In a code block I don't experience this issue. (and in a code block / inline code, the logged parsing should never happen). (I can try again on windows, but this is my current findings.) |
I can reproduce this at will now that I have done all the testing I did yesterday. It is from this specific regular expression as it appears here The next line should be 3 Backticks, but I can't figure out how to make Github not take that as an end codeblock. If I add single backticks around the RegEx on the same line then it goes away.
I also just discovered, if I indent the Regex in the Codeblock it does not throw the error. |
Does the following error on your end (because it doesn't for me on both linux and win11)? nue create nobkd/nue-var-in-codeblock-repro
nue -r nobkd-nue-var-in-codeblock-repro The above downloads the main branch from my github repo Have you already tried deleting the Tip you can do the following in (commonmark) markdown, to include md codeblocks in codeblocks: ````markdown
```js
console.log('hello world')
```
```` basically start and end count of backticks have to be equal |
No, that project does not error. Here is the contents of the markdown file
and the nue file I am experiencing this with
````markdown
---
include: [form]
inline_css: true
title: config_status
og: img/http___127_0_0_1_7411_config_status.png
credits: That cool Scraper Program
---
# User Documentation: Untitled Page
## Purpose
This page provides a configuration interface where users can manage
settings for various components such as buttons and tests. It allows for
viewing existing configurations, editing button settings, running tests,
and monitoring results.
## Dependencies
- **External Libraries**: jQuery and Bootstrap (for styling and
interactivity)
- **Browser**: A modern web browser with JavaScript enabled
## Usage
1. **View Configuration Settings**: Navigate to the page and click on any
configuration group to view its details.
2. **Manage Button Settings**: Click "Manage Buttons" to edit button
configurations, including task definitions and validation rules.
3. **Run Tests**: Select a test configuration and click "Test Now" to
execute it, observing the results in real-time.
4. **Access Logs**: Use the "View Logs" option to review test execution
logs for troubleshooting.
## Screenshots
1.  - Overview of configuration
groups like BUTTONS and TEST.
2.  - Interface for editing button
settings.
3.  - Output after running a test
configuration.
## Key Features/Elements
- **UniqueID**: A unique identifier for each configuration entry.
- **Config**: The specific configuration group, such as BUTTONS or TEST.
- **ConfigDesc**: A brief description of the configuration group's purpose.
- **BSNMatch**: A regex pattern to validate Business System Number (BSN)
formats.
- **LabelMatch**: Another regex for matching labels associated with
configurations.
## Code Snippets
### Regex Patterns
```markdown
**For BSNMatch:**
/^(?P<BSN>B[0-9A-Z]{4})$/
```
**For LabelMatch:**
/^(?<BSN>\S{3})$/
These patterns determine validation rules for BSN and label formats in the
configurations.
````
The line after For LabelMatch is the issue. If I add single backticks to
that line it errors. If I remove the codeblock from the project you sent it
also has errors. i suppose I MUST have a regular expression in a codeblock.
…On Tue, Apr 8, 2025 at 2:42 PM nobkd ***@***.***> wrote:
Does the following error on your end?
nue create nobkd/nue-var-in-codeblock-repro
nue -r nobkd-nue-var-in-codeblock-repro
The above downloads the main branch from my github repo
nobkd/nue-var-in-codeblock-repro
The second line runs the project (we don't run projects created from a gh
repo automatically)
------------------------------
Have you already tried deleting the .dist directory? rm -r .dist
Can you send the file it errors on, so I can take a look?
------------------------------
Tip
you can do the following in (commonmark) markdown, to include md
codeblocks in codeblocks:
````markdown
```js
console.log('hello world')
```````
basically start and end count of backticks have to be equal
(I think: end tag count can be longer or equal to start count. so longer
backtick counts inside won't work properly)
—
Reply to this email directly, view it on GitHub
<#548 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXUOUICJCEXGTQKE5OJQ6FT2YQRCFAVCNFSM6AAAAAB2T5UOXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOOBXGQ4TENBQGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
*nobkd* left a comment (nuejs/nue#548)
<#548 (comment)>
Does the following error on your end?
nue create nobkd/nue-var-in-codeblock-repro
nue -r nobkd-nue-var-in-codeblock-repro
The above downloads the main branch from my github repo
nobkd/nue-var-in-codeblock-repro
The second line runs the project (we don't run projects created from a gh
repo automatically)
------------------------------
Have you already tried deleting the .dist directory? rm -r .dist
Can you send the file it errors on, so I can take a look?
------------------------------
Tip
you can do the following in (commonmark) markdown, to include md
codeblocks in codeblocks:
````markdown
```js
console.log('hello world')
```````
basically start and end count of backticks have to be equal
(I think: end tag count can be longer or equal to start count. so longer
backtick counts inside won't work properly)
—
Reply to this email directly, view it on GitHub
<#548 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXUOUICJCEXGTQKE5OJQ6FT2YQRCFAVCNFSM6AAAAAB2T5UOXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOOBXGQ4TENBQGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
That happens because nuemark tries to parse So replace **For LabelMatch:**
- /^(?<BSN>\S{3})$/
+ /^(?<BSN>\\S\{3})$/ Hope that resolves it for you! |
Describe the Bug
When running my application based on the blog demo. I get a syntax error in the render-inline.js file. It appears when a regular expression is encountered in my Markdown file. It seems to occur when the render encounters a regular expression in a code fence.
Environment
Minimal Reproduction
The syntax error appears to choke when render-inline.js encounters the regular expression in the markdown. My markdown file includes this section
I was able to eliminate the syntax error by putting single backticks around the regular expression inside the code fence like this
Logs & Additional Context
I have edited my render-inline to log each of the parameters as they are passed around the file to aid in troubleshooting. Here is the result of that output.
Logged in the console from render-inline
renderTokens - Log tokens: [{"text":"/^(?P<BSN>B"},{"is_tag":true,"name":"0-9A-Z","attr":{"class":""},"data":{}},{"is_var":true,"name":"4"},{"text":")$/"}] and opts: undefined
renderToken - Log token: {"text":"/^(?P<BSN>B"} and opts: {}
renderToken - Log token: {"is_tag":true,"name":"0-9A-Z","attr":{"class":""},"data":{}} and opts: {}
renderToken - Log token: {"is_var":true,"name":"4"} and opts: {}
rendderVariable - Log expression: 4 and data: {}
52 | export function renderInline(str, opts) {
53 | return str ? renderTokens(parseInline(str), opts) : ''
54 | }
55 |
56 | function renderVariable(expr, data) {
57 | const fn = new Function('data',
return data.${expr}
)^
SyntaxError: Unexpected number '.4'. Expected a ';' following a return statement.
at (C:\Users\byron\node_modules\nuemark\src\render-inline.js:57:18)
The text was updated successfully, but these errors were encountered: