Skip to content

Restore old anchor generation behaviour from before v1.15.0 #578

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

Merged
merged 1 commit into from
Jan 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"author": "Jiang Sheng <[email protected]>",
"license": "MIT",
"dependencies": {
"@sindresorhus/slugify": "^0.8.0",
"bluebird": "^3.4.7",
"chalk": "^1.1.3",
"cheerio": "^0.22.0",
Expand Down
14 changes: 14 additions & 0 deletions src/lib/markbind/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/lib/markbind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"author": "Jiang Sheng <[email protected]>",
"license": "MIT",
"dependencies": {
"@sindresorhus/slugify": "^0.8.0",
"bluebird": "^3.4.7",
"cheerio": "^0.22.0",
"fastmatter": "^2.0.1",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/markbind/src/lib/markdown-it/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ const markdownIt = require('markdown-it')({
return '<pre class="hljs"><code>' + markdownIt.utils.escapeHtml(str) + '</code></pre>';
}
});
const slugify = require('@sindresorhus/slugify');

// markdown-it plugins
markdownIt.use(require('markdown-it-mark'))
.use(require('markdown-it-ins'))
.use(require('markdown-it-anchor'))
.use(require('markdown-it-anchor'), {slugify: slugify})
.use(require('markdown-it-imsize'), {autofill: false})
.use(require('markdown-it-table-of-contents'))
.use(require('markdown-it-task-lists'), {enabled: true})
Expand Down
2 changes: 1 addition & 1 deletion test/test_site/expected/bugs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</navbar>
</div>
<div class="website-content">
<h2 id="popover-initiated-by-trigger%3A-honor-trigger-attribute">popover initiated by trigger: honor trigger attribute<a class="fa fa-anchor" href="#popover-initiated-by-trigger%3A-honor-trigger-attribute"></a></h2>
<h2 id="popover-initiated-by-trigger-honor-trigger-attribute">popover initiated by trigger: honor trigger attribute<a class="fa fa-anchor" href="#popover-initiated-by-trigger-honor-trigger-attribute"></a></h2>
<p><a href="https://github.com/MarkBind/markbind/issues/49">Issue #49</a></p>
<p>Repro:</p>
<p>
Expand Down
6 changes: 3 additions & 3 deletions test/test_site/expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ <h1 id="panel-with-heading-with-keyword">Panel with heading with keyword<a class
<span class="keyword">panel keyword</span></panel>
<h1 id="expanded-panel-without-heading-with-keyword">Expanded panel without heading with keyword<a class="fa fa-anchor" href="#expanded-panel-without-heading-with-keyword"></a></h1>
<panel header="# Panel without heading with keyword<a class='fa fa-anchor' href='#panel-without-heading-with-keyword'></a>" expanded="">
<h1 id="keyword-should-be-tagged-to-this-heading%2C-not-the-panel-heading">Keyword should be tagged to this heading, not the panel heading<a class="fa fa-anchor" href="#keyword-should-be-tagged-to-this-heading%2C-not-the-panel-heading"></a></h1>
<h1 id="keyword-should-be-tagged-to-this-heading-not-the-panel-heading">Keyword should be tagged to this heading, not the panel heading<a class="fa fa-anchor" href="#keyword-should-be-tagged-to-this-heading-not-the-panel-heading"></a></h1>
<p><span class="keyword">panel keyword</span></p>
</panel>
<h1 id="unexpanded-panel-with-heading-with-keyword">Unexpanded panel with heading with keyword<a class="fa fa-anchor" href="#unexpanded-panel-with-heading-with-keyword"></a></h1>
<panel header="# Panel with heading with keyword<a class='fa fa-anchor' href='#panel-with-heading-with-keyword'></a>">
<h1 id="keyword-should-be-tagged-to-the-panel-heading%2C-not-this-heading">Keyword should be tagged to the panel heading, not this heading<a class="fa fa-anchor" href="#keyword-should-be-tagged-to-the-panel-heading%2C-not-this-heading"></a></h1>
<h1 id="keyword-should-be-tagged-to-the-panel-heading-not-this-heading">Keyword should be tagged to the panel heading, not this heading<a class="fa fa-anchor" href="#keyword-should-be-tagged-to-the-panel-heading-not-this-heading"></a></h1>
<p><span class="keyword">panel keyword</span></p>
</panel>
<h1 id="heading-with-included-keyword">Heading with included keyword<a class="fa fa-anchor" href="#heading-with-included-keyword"></a></h1>
Expand Down Expand Up @@ -234,7 +234,7 @@ <h1 id="html-include">HTML include<a class="fa fa-anchor" href="#html-include"><
<p>This is a HTML document</p>
<p><span>It is <strong>possible</strong> to use Markdown in HTML</span></p>
</div>
<h1 id="mbd%2C-mbdf-include">Mbd, Mbdf include<a class="fa fa-anchor" href="#mbd%2C-mbdf-include"></a></h1>
<h1 id="mbd-mbdf-include">Mbd, Mbdf include<a class="fa fa-anchor" href="#mbd-mbdf-include"></a></h1>
<div>
<p><em>MarkBind supports .mbd files.</em></p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h1 id="specifying-requirements">Specifying requirements</h1>
The next phase is to convert requirements into a product specification that specifies how the product will address the requirements. </seg>
</p>
<p>Given next are some tools and techniques that can be used to specify requirements. Note that they can also be used for establishing requirements too.</p>
<h2 id="textual-descriptions-(unstructured-prose)">Textual descriptions (unstructured prose)</h2>
<h2 id="textual-descriptions-unstructured-prose">Textual descriptions (unstructured prose)</h2>
<p>This is the most straight forward way of describing requirements. A textual description can be used to give a quick overview of the domain/system that is understandable to both the users and the development team. Textual descriptions are especially useful
when describing the vision of a product. However, lengthy textual descriptions are hard to follow.</p>
<h2 id="feature-list">Feature list</h2>
Expand Down
6 changes: 3 additions & 3 deletions test/test_site/expected/siteData.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"outer-nested-panel-without-src": "Outer nested panel without src",
"panel-with-src-from-another-markbind-site-header": "Panel with src from another Markbind site header",
"unexpanded-panel-header": "Unexpanded panel header",
"keyword-should-be-tagged-to-this-heading%2C-not-the-panel-heading": "Keyword should be tagged to this heading, not the panel heading | panel keyword",
"keyword-should-be-tagged-to-this-heading-not-the-panel-heading": "Keyword should be tagged to this heading, not the panel heading | panel keyword",
"panel-without-src-content-heading": "Panel without src content heading",
"panel-normal-source-content-headings": "Panel normal source content headings",
"panel-source-segment-content-headings": "Panel source segment content headings",
Expand Down Expand Up @@ -45,7 +45,7 @@
"boilerplate-include": "Boilerplate include",
"nested-include": "Nested include",
"html-include": "HTML include",
"mbd%2C-mbdf-include": "Mbd, Mbdf include",
"mbd-mbdf-include": "Mbd, Mbdf include",
"include-from-another-markbind-site": "Include from another Markbind site",
"trimmed-include": "Trimmed include",
"fragment-with-leading-spaces-and-newline": "Fragment with leading spaces and newline",
Expand Down Expand Up @@ -82,7 +82,7 @@
},
{
"headings": {
"popover-initiated-by-trigger%3A-honor-trigger-attribute": "popover initiated by trigger: honor trigger attribute",
"popover-initiated-by-trigger-honor-trigger-attribute": "popover initiated by trigger: honor trigger attribute",
"support-multiple-inclusions-of-a-modal": "Support multiple inclusions of a modal",
"remove-extra-space-in-links": "Remove extra space in links"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="segment">
<h3 id="panel-source-segment-content-headings">Panel source segment content headings</h3>
</div>
<h3 id="this-heading-is-not-src-of-any-panel%2C-so-it-should-not-be-in-the-search-data">This heading is not src of any panel, so it should not be in the search data</h3>
<h3 id="this-heading-is-not-src-of-any-panel-so-it-should-not-be-in-the-search-data">This heading is not src of any panel, so it should not be in the search data</h3>