-
Notifications
You must be signed in to change notification settings - Fork 46
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
automatically fill the id attributes of the headings #267
Closed
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5727396
automatically fill the id attributes of the headings
tatchi a25466b
inline Fun.negate impl
tatchi 1a32e7b
unicode version of slugify
tatchi 2e52f7c
add an --auto-identifiers boolean option
tatchi a0ce723
refactor slugify fn and add more tests
tatchi 0ed7b79
trim spaces
tatchi ad0b2a9
add comment
tatchi 36c6f9a
turn off auto_identifiers in tests
tatchi 1fb9404
generate unique ids
tatchi ff3b1c8
introduce Identifiers module
tatchi c07e958
switch to another impl
tatchi 02c6fe8
Use index and accumulator to clean up drop_while
shonfeder 8f4a3fb
Merge branch 'master' into auto-id-for-headings
tatchi f5cab78
add a test with auto-identifiers option disabled
tatchi 4cdac96
Merge commit '02c6fe8f07e43f744928fd16d39ac2fc3b3c9b88' into auto-id-…
tatchi f2ffab2
Use accumulator to clean up slugify
shonfeder 820f310
move some logic into slugify function
tatchi 2096643
Rework auto-identifier doc to be declarative
shonfeder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
$ omd << "MD" | ||
> ### This is an Header Without Id | ||
> ### 1 2 Header that starts with 2 numbers | ||
> ### Header with an id {#header-id} | ||
> ### Maître d'hÔtel 😬 | ||
> ### 👋👋 ÔHey! 👋👋 | ||
> ### 👋👋 ÔHey! 👋👋 | ||
> ### *Dogs*?--in *my* house? | ||
> ### [HTML], [S5], or [RTF]? | ||
> ### 3. Applications | ||
> ### hello.world | ||
> ### -hello- | ||
> ### with multiple spaces | ||
> ### with spaces | ||
> ### 33 | ||
> ### | ||
> MD | ||
<h3 id="this-is-an-header-without-id">This is an Header Without Id</h3> | ||
<h3 id="header-that-starts-with-2-numbers">1 2 Header that starts with 2 numbers</h3> | ||
<h3 id="header-id">Header with an id</h3> | ||
<h3 id="maître-dhôtel">Maître d'hÔtel 😬</h3> | ||
<h3 id="ôhey">👋👋 ÔHey! 👋👋</h3> | ||
<h3 id="ôhey-1">👋👋 ÔHey! 👋👋</h3> | ||
<h3 id="dogs--in-my-house"><em>Dogs</em>?--in <em>my</em> house?</h3> | ||
<h3 id="html-s5-or-rtf">[HTML], [S5], or [RTF]?</h3> | ||
<h3 id="applications">3. Applications</h3> | ||
<h3 id="hello.world">hello.world</h3> | ||
<h3 id="hello-">-hello-</h3> | ||
<h3 id="with-multiple-spaces">with multiple spaces</h3> | ||
<h3 id="with-spaces">with spaces</h3> | ||
<h3 id="section">33</h3> | ||
<h3 id="section-1"></h3> | ||
tatchi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Auto identifiers option disabled | ||
$ omd --auto-identifiers false << "MD" | ||
> ### hello | ||
> MD | ||
<h3>hello</h3> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we can have the
block
function take a record for this argument that can carry some configuration/state? For the identifier numerical suffix, it could be aint StringMap.t
. Of course, we could also use a mutable hash map for this, but would be nice to avoid if feasible. WDYT?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion, I added an
int StringMap.t
to keep track of the numerical suffix. Let me know what you think :)