Comments (4)
Great, it works just find... You may can propose it as pull request ?
from cms.js.
I just noticed the comment in the code
// headers - fix link anchor tag regex
I guess this is a known issue
from cms.js.
EDIT: SCRATCH THAT I THINK I MISUNDERSTOOD HOW THE CODE WORKS WHEN GENERATING HEADERS
I'm no expert on regex, but I tested this out and it works.
// headers - fix link anchor tag regex
{regex: /(#+)([^\/])(.*)/g, replacement: (text, chars, content) => {
var level = chars.length;
return '<h' + level + '>' + content.trim() + '</h' + level + '>';
}},
It tests that there's no /
following the first #
Here's a test case
regexr.com/49sbu
from cms.js.
Hi roskelld,
I'm no expert on regex, but I tested this out and it works.
// headers - fix link anchor tag regex {regex: /(#+)([^\/])(.*)/g, replacement: (text, chars, content) => { var level = chars.length; return '<h' + level + '>' + content.trim() + '</h' + level + '>'; }},
It tests that there's no
/
following the first#
This code works in filtering # in url links, however it also breaks the detection of regular headings on page markdown articles.
Here's an alternative regex, that works in both cases:
regex: /(#+)(?!\/)(.*)/g
This one assumes that a # preceding a url is directly followed by a / which makes sense in the cms.js environment (e.g. /#/pages/somearticle)
from cms.js.
Related Issues (20)
- Allow to publish new content HOT 10
- markdown code area not correct HOT 1
- each page view requests all other pages HOT 5
- Split CMS.js file in to smaller parts HOT 9
- 1 day longer than normal
- Post list in example not displaying correct date
- Can't see any posts HOT 8
- Fix Google Crawler Issues HOT 2
- Can't put url on post metadata and pull them via the template engine HOT 2
- Gitlab Support HOT 1
- Feature Idea
- Support for websites without Indexing support HOT 6
- null fileUrl causing errors
- Cannot read property 'split' of undefined HOT 3
- Issues trying to retrieve pages/posts file listing in SERVER mode HOT 4
- IE11 support / Object.assign() HOT 1
- Starter project not working
- Not working in NGINX
- Please add default dark theme
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cms.js.